Remove whitespace and format codes