Add option to disable warnings
Minor refactoring