Added more logic for basic workflow