improved the valid inputs section