new constraints, code cleanup