Midway through Part-2. Implemented upto sub-script.