set right handlers to main and json
add tests and hendler for tests