Merged the render functions into one. Some comment clean up and inline documentation