removed session variables to simplify code