Added comments and clean up