Added last id function