refactoring task argument
set task function and closure object on create
implemented basic tests