Added in logout, user online presence functionality. Clean up codes