It's much easier to discuss on real code. Try to implement it, and I'm sure we can have a more thorough discussion afterward.