Updated solution for Q3