- changed algorithm a bit.