first near-working version