updated spinner function