Add emergency code feature

Closes #1