Code Validation/Factorization