tidied up  everything and made a demo output file per Beck's suggestion