Added comments & bugfix related to substring