Code is race-free and mostly working