Update comments and add an onInterrupt function