refactoring and missing comments