almost complete  rehreshView function