refine code, add depth class