Fixed a few memory leaks
Added trim whitespace task