partially finished main and started converting Younger's code