code refactoring and documentation completed