valid/invalid refactoring