May I suggest creating a temporary list for new elements to add to data, then return it instead of modifying a list received as a parameter? This is a pretty big side-effect IMHO.