added tests and integration