Converted everything from yaml_document to yaml_events and fixed memory issues via valgrind