Final push from me. Added most functionallity. Needs debugging still.
Not sure what's breaking it.