Refactored to use a shared session; needs a cleaner refactor for later