first cut algorithm work, likely only works for trhph!