Added code from teacher