Revert "sw: small code refactor"

This reverts commit 7b073527da7dce314e14dba7b34245db3f0b5ae1.

It seems to require additional testing in Windows so I'm taking it
back at the moment.