Finally getting ternery ifs sorted out, as well as bringing C implementation more inline with conceptual model