Added more comment and clean up