refactor for table lookup
add Makefile
add asserts