removed bugs, changed the output format