Moved some template stuff to the bottom of the file

it doesn't add anything but visual complexity
draw scroll arrows if necessary