added a subroutine to the generator
major cleanup and reorganisation of the code, a...
Merge remote-tracking branch 'origin/master'