more flexibility, adds tests/docs