fixed some operations and removed garbage