Added check for valid scheme