FIX: Replace trim functions to make it IE8 compatiable