Extract some duplicated control building and updating code
Add some more parameter checking