connected ui and added refresh function