code refactoring and documentation performed