added adversary and cleaned up some code