Added function for recursive sub tasks