Refactor to packages