Trim all the things
Added optional JS argument parsing