removing unnecessary $hash definition
refactor on the signature generation to simplify it a bit