Code adapted to GroveSBT's controller onNewLine callback