Seems like you're trying to make the solution to a relatively simple problem much more complicated than it needs to be.