Fixed right click bug, refactored code, ensured tool sync while gui open