q crud refactoring