Simplified error handling, added signing and verification tests