Added session variables and did cleanup