First Version with region detection optimized