Lots of Changes

Started adding a lot of comments and added some error checking back in.