refactored on drag event