this should make the integration code for hrixs more readable, and also fixes a bug. See merge request !231