improve constraints and put them into separate file