reshuffle loads of code, huge tidying up, optimisation, and added multiple delimiters