added logout ability
code cleanup for sharing