clean up and optimizations for glcd