re arrange login stuff to save device ids