did 1.2 and 1.3 of the optional assignments. added tests to support them