rewrote xDrop in c++