Initial copy pasta from problem 1 with control modification