Message signing functional and tested, refactoring.