created edit function and abunch of other stuff