Improved test system.

Removed the need for shrpx, refactored, added tests.