fixed some things to be able to use an array of results instead of an array list