Refactor package hierarchy