reviving the old algorithm