made hsm into abstract interface
simplify method
simplify a bit