A few improvements, mostly code-style