add use of session to improve stability and performance