Removing empty segments