Fixing shims

Added shim for `trim` from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim

Also, using `indexOf` shim everywhere