Improved code and fixed details. Added mouse drag with right button