Refactor reasons_to_skip into a function