Removd unecessary recursion, fixed some task bugs