This does not yet have full coverage. Test cases covering failsafe paths and error injection will be added eventually. Signed-off-by: Ophestra <cat@gensokyo.uk>