Made more changes to arangment algo