ducomentation and refactoring