Final version of ass2 code.