refactoring the dock