fix global state bug + move routes to /routes