Working version with a session.