this is the first version that (kind of) works