UPDATED tests and sample code.