Added given code from teachers