Sessions are now working. Changes to to_JSON function.