Implemented most cases for SAM now. Redirect to login form still needs
to be done.