Struggling with mutable array and threads