final rewrite of json data structure, puttings calculations in service, clean coding