Tidy the application with new comments and some minor code changes

* Use is_readable() instead of file_exists()
* Make the authentication method accept a single token instead of an
array of cookies
* Remove some comments, improve some others.