refactor into separate packages