moved pat table construction into Init
added ts file for unit test