Api cleanup and the stuff that comes with it

@gholtslander 

Made all of the apis use functions from functions.php, so they'll be easier to reuse and write. It'll also help with my unit testing efforts coming soon!
http://sandbox.holtslander.com/miniblog/adm/index.php

Check out how this page looks like now