refactoring,  comments & cleanup