Restructured app to use AJAX to update the page