Moved things to sessions_functions.php for cleaner code.