signs and verifies. needs simplification refactor for clearer parameter passing.