Moved state atom setup into the atom