Move steps out to functions