improve week7 assignment