Some improvements for #1.