Added some ajax, and managed to break a few things along the way