Refactored and cleaned up code.  Modernized some constructs.

Thanks for creating this!  I am hoping to make some contributions to the project, but first I wanted to start by doing some code refactoring.  Most of these are based on introspections and simple code refactoring.  Where it seemed safe to do so I also updated some code constructs as well.  Please let me know if you have any questions.