Tidied code and edited readFile