Moving rendering code into rendering class

Moving rendering code into rendering class