working out mutex solution.