add constraints for paper + refactoring