Add ajax.php and some refactpo