debug: int/int->double for Xtot and logwidth calculations (corrected in all three code versions)