Added managed multhithreaded crypto
Some refctoring