Better handling of session.