Modified according to the tutorial.