Refactor: use AJAX