Customized authorization, cleaned up TODOs, and cleaned up a bit of code.
Added some docs, TODOs, and minor style/HTML changes. Also rearranged and simplified some code.