Added utilities method to generate keys. Other minor changes.