refactored drag and drop a bit and fixed a dependency bug