Fixed output index to work 0-7