this should ~work. Needs testing