Some factorisation, loops unrolling and switch cases twindling
Added a 1bit get function. Optimization here and there