converted tabs to spaces
State switching works