changing stuff to be more atomic