First real code
Produces correct - I hope - output, but lacks extra help functions.