finished assign 3 but need to optimize