Add an event for code cell creation

I also cleaned up a misspelling ('buton') by noticing the variable wasn't used, so I just deleted the variable.