refactored the glu code to make it easier to spot and for parts to be easily usable on non-Arduino client platform