Handle preprocessing