Move token logic out, make serve_docs an wrapper for overriding