Added proper dock handling