Fix horrendous bugs in trim function
Invert coords in input name
Merge branch 'php' into gh-pages