refactor and export less functions from all packages