Added safer removal of views

Was crashing when dismissing the view stating attempting to add a 'nil' object to array. This fixed that problem for me.