Cleanup: move filterloop() common for( k ) loop outside conditional compilation