optimize ajax controller to use lazy controller (remove code duplication)