Polished source code and fixed typos.