Better Validation algorithm