Moved code that required the api to a more appropriate place in dashboard.php
Added minimal documentation generated by phpdoc.