The hW-inference Algorithm: Theory and Application