Check if user has a valid session
Set cookie expire time
Removed unused comments