Fix various bugs, and implement editing preexisting light states and commands.