Refactoring and modularisation continued...
refactoring