added actual updating functionality. Terrible code.