This array function is kicking my butt.