refactoring to remove unnecessary session checks