Merged control and menu condition code

The code has been merged, but transference is not fully functioning. Some cleanup is still required.
Let's try to arrange the functions for object grouping and the ones for checking constraints so they can be in the same block of lines.