Added tests, fixed a bunch of bugs. Adjustments of Pash internals in order to use the new architecture correctly.