Fixed bugs and replaced refresh