This feels a little strangely written and quite difficult to read. Perhaps this could just accept a selector?