Optimized function applyUserSelectedConstraints, by removing a lot of empty spaces and unuseful brackets.