refactor main package