Move method checking & json response creation to dedicated methods

Remove dead code.