Added code for parsing end key