refactor artifact cleanup
some more refactoring