Apparently IE does not support String.prototype.trim, also some little cleanup