There is quite duplicate code in the four get_XXX_additions() functions from line 26 to line 160. Try share the functionality rather than copy-and-paste.