simplified code

removed ajax function