got singlethread mainloop going, added more support code to intialise rendering