this looping is blowing my mind a little - not sure what the outermost loop over .availability is for? It seems like you could get rid of that loop, have meal check return the function and then start the loop over meals?