completed inv refactorization