Implemented dsFinalize
Removec unused code and imports. Added comments for setPermission method
Removed unused imports
Added finlize at the end of worker loop