Normalized db tables and re-factored ajax request