refactor completion block handling in dismiss method