Added comments, improved functionality, still a lot of work to do.