I'm beginning to suspect that perhaps you're going about things the wrong way. Rather than tell us the technical stuff, what exactly are you trying to achieve? What are the inputs, what are the outputs? Perhaps then we can suggest a good, efficient, simple solution.
Often, if things start to get bogged down, you have to approach the problem from a different place.
regards
matt