Optimized the Code on my local machine. Runtime testing on thje cluster for each optimisiazion still needs to be done.