Reverted changes; changing algorithm instead.