rearranging code to make writing new filters easier
not sure why git is forcing me to commit this...