Refactors program, use of buffers and rendering

Refactors use of programs, buffers and the way triangles are rendered

* extracts common functionality associated with programs to Program class
* code in main class becomes a bit easier to understand and got simplified