added code from lectures 54 and 55