Refactoring trying to fix some logic issues
Merge pull request #77 from svanharmelen/COOK-3652-bugfix

Refactoring trying to fix some logic issues