im really lazy, and this seems like alot of effort.
Well that's too bad, because here you have to make an effort in order for us to make an effort to help you.
Your idea is good, just don't let the idea overwhelm you, do it in parts. Does this function have to work with different data types too?