refactor code for checking new packages