Refactoring, helpers, undo fixes