Also, you know the length of the encoded id . . . you don't need to search using 'indexOf'.