Refactored controller

It needs not respond to anything other than js.
Most of the past ugliness was due to html support.