Reorganize code
Improved signature matching