Clearing references to unnecessary objects