add refresh function, and auto scroll to the bottom