build function is now correct
code cleaned & added: build_fromstring and build_from_file