Refactoring to support config file and tidy up function-name generation