Refactor main package.