Rename main code and wider use of dataset variable