Throw exceptions when needed and keep module state in sync.