Fix minor typos and improve grammar and code formatting

[ci skip]