moved setup back into main, .c-ified states and filter