session close, password encrypt, and optimization