adding a lot of new functionality

Signed-off-by: riabop <riabop@gmail.com>
Detect properly when a piece can be erased

Now I detect properly when a piece can be erased

Signed-off-by: riabop <riabop@gmail.com>