must remember to count array indices properly