more improve

Need to convert to php classes or split php file