May possible have the substring thing sorted out, the is the code before first submission.