add some more tests and comments as per review