is_valid method added