#4 and #7 more work for introducing session based api