A cleaner datastructure will be really nice and make the code below much readable.