Added session expiration logic and related test