moved setState out of callback so it updates immediately