Added some comments and clean up