Fix #686 - small code tidy ups.