Fixed range bug by using struct_contains in place of exists