Debugged

Works in shallow case