Updated tests and code