fixed typos and layout of code