attempt at optimisation. perhaps sacrificed the code niceness though. no improvement visible. stay tuned for reversion.