Tidy code, fix warnings.