fixed deleting objects on collection
code cleanup
updates for arrays