redone main.js + renames in ClientState