1. Fixed incorrect cookie path that stopped cookie from being written.
2. Changed cookie to session cookie.
Fixed up cookie reading code & minor code cleanup.
Removed trace message.