Added some comments, cleaned up a bit more