i smell a function for the code here .... there's only a few differences between each branch of the first `if` statement...see if you can abstract it a bit to make it more readable