Added comments, code clean up