Added function to check for conflicting task

Refactor logic test as well, as it affect the test cases.