Added code to handle path changes