Style changes - fewer local helper functions
Factor out common GLFW code

This will need more work for programs that take input