Cleanup db query
Just use json
Refactor display_top and display_bottom into a single block template tag