Completes pen functionality and adds pen tests.