look up table function - currently slow
Merge branch 'lookup'