Moved some render logic to methods