fixed offsets and added mouse click event handling