improve validator class