Implemented initial planning logic
Massive refactoring for task status management