fixed pattern_tools
began parallelisation of other functions