clean up of apsp()