Various changes by jfabi.