first step in modularising functions