Add interrupt option & onStop callback

Also made some fixes to the coding style, e.g. there was places where spaces were being mixed with tabs.