re implementation of granular accounting logic