Replaced string cast with explicit method call (fixes regression from previous commit)
Moved element blocks into subforms.
Preserve URL parameters in sortable table headers - makes these work for pages that need parameters.