Added lookup table algorithm and some tests