Improve code of select drag drop component