Mostly code cleanup
Fixing good old user/password  flow
Code cleanup. Handling expiration of applicationKey token.
Adding test for logging.
Removing typo