Remaining changes to control condition

These are the changes made to the control condition after the first pull request.
This function can be simplified. All code that is common to all of the if statements should be outside of the if blocks. E.g. the first three lines where you pull out the obj1Id, obj2Id and action.