Some improvements based on comments in #3