basic modularisation of code