changing array to 0 based not 1 based