I did try a lookup table, ran into an issue with it.
Created another thread for it here. Could you please have a look.