new code rewrite

major php code rewrite