rewrite ajax processing code...part 1