refactor package tree