Fix typos
Use set_size()+iterator instead of set_capacity()+append() (performance improvement)
Improve code documentation