fixed a bug in drag and drop
cleaned up msg box and made it more modular