rearranging code to abstract fuse usage and get better testability