Fixed the code to be in the same state as it was before the refactor