Had some brain dead fail moments, but had less of them than I expected.
IGT - https://pastebin.com/qbWtqcav