starting to modularise and test