Move check_session and check_auth