made value_checker method to make code cleaner