try to minimize atomic ops