state.py: top -> top_, to avoid shadowing the func