moved all rendering code out of engine