Added a refresh funciton to resize