Tried refactoring but processing didn't like it