Optimize how gui elements check for mouse actions

#112 #113