this code had a variety of stylistic fascinations... thanks @adamrp for the refactor on this