Revert "Revert "refactoring for package structures""

This reverts commit 35df5afe659e696e580b6bbbfaab3455d795cdb9.