Factor helpers out into seperate modules

Cleanup types, hlint, warnings while we're at it
ECDSA signature algorithm