Optimized database queries for frontend views. (Issue #15)
Made page_script_block optional.