first version that somewhat works