added depth function