Moved code for rendering objects to respective objects.