undid most of referenceamount, initial rawtx code is in