Add auto refresh feature and some tests