Refactoring before final submission