main workflow