Some code reorganisation to remove code duplication. No eal changes in the result
Merge branch 'master' of https://github.com/ishurmin/SClab2