Changed array ranges to conform to pascal's rules.