Refactor
Cleanup and session variables