Restored inline edit functionality

It took a lot of fiddling around to figure out the new structure of the
script, but I was able to restore inline editing functionality. There
are a few issues, explained inline.