array indices cleaned up to eliminate unnecessary subtraction
spurious iostream removed