Some code cleanup and style tweaks