Code from class 1/21 - controls