First go at HSM with some testing.