Removing buggy code that didn't update variables that weren't used