finished algorithm, added test transactions (currently working on them)