Refactor task commands