addBean(...) API, unit tests and minor fixes