need help by Matrix optimization

    Apr 24 2006 | 9:45 am
    Hello everybody,
    For one of my graduation projects I'm building a step sequencer which controls my installation. The thing works but the code is way too much lines. I would like to build it more generic.
    I use a matrix for the gui and the getcolumn output linked on to my audiotracks. Works great.
    Now I want to control a led board. So I use 2 routes so set a led on and off and de decode to show the time steps. And this part is a bit of a mess. please take a look my code.
    Probably a newbee question again but at least it's not a DJ patch.
    The max patch 4.5: