Cleaned out the program. Added lots of comments.