Tweak function to accept array