move skip_if_empty to separate function for test coverage