Perhaps you could tell us what you're trying to accomplish in the end? There are quite a few tools available that perhaps could be adapted to suit your needs more easily than building something from the ground up.

Matthew