state switching
separated states into different files