Reordered html/json handling in controller
Merge pull request #34 from wilchandler/json-html-bug

Reordered html/json handling in controller