moved all rendering code to renderer class