Fixing trying to call function to an array