redid error refactoring
fixed merge conflicts