I completed it! You can now find the current script at https://gist.githubusercontent.com/anonymous/ffa92d8f8b12fe630e947ceba78da059/
Please let me know if anything is missing. It should be pretty self-explanatory in the shell if called. Thanks for all your help!