More complicated than neccessary perhaps, but rendering works and rare thread collissions