Added locking so only one instance is running