Refactoring: initial consistency fixes