constraints are applied (not sure if correctly), definitely still some errors in inference algorithm