organising the scripts - towards functions