add pretty print, fix where n = 4 bug