Changed API

Fixed bug in genereting key from string.
Removed unecessary variable.