refactoring according new API