implemented methods -modifyByInverting and -modifyByNegating

also fixed a few errors in test code