implement which mouse button, and more refractoring

something weird happened during refractoring, that's why there are so
many changes