update tests and code