removes white space and fixes brackets.