modified beautify script