Moved login and logout functionality to same class
Added modifiers
Added deep copying of objects
Prevented possible memory leak when using this
Optimized algorithm
Removed deep copying from variables that's allowed to be null