implementing assignment #2