This Code Works pretty well