changed input and fixed output of the array