improve code quality/performance of virmodel