changed library design to feature $in and added/fixed constraints