Removed .trim() due to IE8 incompatibility, used relace() instead