Tried fixing the out-of-sync bug
Refactoring