Final version for tutorial 2