Got it to work

Cleaned up the code, removed unneeded function, reordered
creation(s)/redirection operations