Added code for view controller dismiss