Fixed up wording, added more comments and better exception handling