Add support for refresh, invalidate, validate endpoints

Clean up exception handling
Format code