Add user lastOnline detection, small refactoring.