Main prog control code moved into module subrtn