Programming Assignment 2. Added docs & test.