Adding lock to ensure startup is thread safe