Performance optimisation (reduce file IO)
Refactoring