Add more constraint types
Template logic refactored