Implemented session wrapper
Bug fixes and improvements