added mouse click handling