nice broken algorithm