added token management
added some exceptions
brushup