changed the prettify function