completed real hx function