Fixed bug in the extraction command + Added some tests.