Refactor to remove session.