Fix svg hiding, switch to callback functions, optimize for mobile