Refactor inverse_scalar