Reorder functions
Whitespace
Remove duplicate code
Move HTML to bottom of file