Refactor Formatter and ResultDistributor classes

- Make them throw exception not return null