Substring function that I haven't tested yet and probably doesn't work