Added locking to refresh method