refactoring task constructor usage. done
refactoring if condition working
working for the canonical example