refine the code
refine the code, move validation into boost