refresh loading gif, abstract functions into helpers, improve addGrammar