refactored docking.