Added support for REST.
Bug fix for login.