Fixing depth threshold efficiencies and threading deadlock issues. Should fix #31 though may cause threading instability - needs testing