refactored and simplified; spec dependencies are replaced by packages;