Fix - session invalidated error when user logs out and back in, or session timeout
No longer using regex to test, using Json
CPK Refactoring - code cleanup