update authenticated? method

* removed passing cookies to it - probably a bad idea.
* most of these sql functions don't exist yet, that's next commit
* trying to break down if condition into multiple lines, am i doing it right?