refactoring + api changes