Tidied imports
Looped import and modified inner loop to iterate on lines not characters