I'm moving away from functions like this. Functions should have a single responsibility and nested `if` statements are the devil. ;) I'll leave better review later after I get out of work. Thanks for sending this!