Building logic and constraint