Updated code and doco.