Refactor JS to improve quality
Refactor PHP to improve code quality