Added check for duplicate running instances