it was already implemented, but more test cases and doc were now added. some other cleanups are made.