Added AJAX functionality and templates