Replace name-checking mechanism.

The old one is refactorable and prone of out-of-bound error.
What's still left out is BGcheck in cycle-layer-frame, it's tightly bound to the function's frame-skipping mechanism.