Really basic formatting tweaks

Looks good overall, just a couple formatting tweaks and consistencies. Also hoisted a couple functions out that will get called often.