Added a DELETE operation for the unregister

Also cleaned up the code a little and added a test script. The test script requires curl to work.