Another thought: you seem to do this same operation a few times, should it go in a function you reuse?