Reorganized funnel code into multiple files.