created a manual substring method