Added tests, refactor the way signing works to be more OO