Refactor into smaller packages