Refactor and add a setSession TODO.