Some code clean-up, codestyle and a minor typo fixed.