Added additional functionality and added example test code within the
main method. Changed where the sessions are created. I still need to
test some edge cases.