Move id functions to helper lib
Add tests
Fix id bugs
Add more tests