Changed some formatting of the source code.
Fixed the call to QGE.
Completely rewrote QGE. Things are now easier to change the problem and things should be correctly implemented now.