This whole thing feels a little awkward and leaves me with more questions than I had coming in. Maybe it would make sense to make it clear what the problem is before going straight into code (beyond the title?)