Improve js file and fix php