refactor extract_[method] and tests