Addded outputs to allow better error checking, added comparison code