implemented authentication and sessions