Switch mainfunc to a gensym and switch the isinstance integer check to integer?