Add checking contain key
Add exception handling