Getting closer to having the refactored version working