refactor into separate subpackage