refactor into 2 packages