AJAX and templating. Many things still need tweaking (see todo-list)