some refactoring, sign/verify abstraction