Refactoring: unused code was deleted, time delay was added to mouse listener