Updates tests and refactors pkg-manager