shuffle: improve dealing with factories. alter newlines