latest code with unit tests