Refactor ECDSA

Mostly fix warnings and hlint, but also some general cleanup.