refactor is_method