implemented session handling