Multi threading is now implemented (still some optimization to do)