Adding lock to ensure it only happens once