Working version now easier to read. Only main program runs