removing dependence on session variables