move rendering logic to controller
only output a controller if it exists