refator input ch validation