Revised code and aligned to tasks