initial solution
refactor if to unless logic and pull out array substraction