Moved inv helper to core