moar refactoring

divided into input, output and prgdicts. now you can really overview the
code by functional division. nice!