Fix typos and improve code style