Added comments and clean it up