working code <end of session>