fix drag n drop and clean up code