Some bug fixes and a little improvement in the documentation