code from assignment