still not fully working but some progress