Improvement on previous refactor