refine spinner function