clean up trip js code