first working(ish) version