move drag code to where it belongs