starting to better modulise the code