Added helper function to assign correct variables

Because of how we pull items out with streams the first, last and
odd_even variables are incorrect. Results are now processed through
filters to ensure they are assigned correctly.