First somewhat working version