Rearranged code to be comfortable with primed data