here is a first working version