Updated Javascript for path detection