Code refactor and bug fixing

there was a few issues with the task type, is now fixed
code is more readable