Corrected NOT command and removed redundant code and added a test case for NOT command