Fixed OpenSSL multicore, added timing function, moved cleanup scripts within functions