Several improvements, mostly about speed.