demo code mostly corrected. need to set tern to use editsession