Whitespace removal and change print to log