moved logic to Session object and added test case