More efficent code

Cleaned code for rendering