Changed depth function