Remove unused variable, and small typehint.

Signed-off-by: crynobone <crynobone@gmail.com>
Reorder some code.

Signed-off-by: crynobone <crynobone@gmail.com>