Fix typos and improve readability

Fixed obvious typos. Changed names of functions with word ‘indexes’ to
‘indices’. Placed spaces between most operators to improve code
readability.