Cleanup

Moved function declarations to end of script. Removed completed todos.