first not working variant
first working variant
some TODOs completed