Added Comments, cleaned up code