added function for AJAX