Refactored checking for end in keys.
Merge pull request #5 from superman3275/master

Refactored checking for end in keys.