Added handling of non-existing data and AJAX for pulling data