Refactor react