Added output option. Added patch test.