Add some test and refactor getCosigner