fixed up pretty print function