cleaned up login processing, added logout processing