Improved documentation to describe current behaviour. Added tests.