Changed double-click protocol and improved code