First code commit

Quick & Dirty implementation that seems to work for a few examples