Refactored so expected input is now an array