g:ResourceInputMode & g:StmtInputMode refactoring