rejig rosalind scripts into usable functions