New task discovery and some code improvements + more tests