Better handling of session. This code does stuff now.