Added some comments. Cleaned up a bit