added ajax handling