added function new_from_str and test; removed unneeded allocations from tests