break renderer code into a separate file