Modified dispatcher

Enclosed the whole dispatching process into try/catch, since fatal exceptions
should not be shown to user due to security reasons; also removed all linebreaks
on json echo