Fix for iOS7, added completion block for dismiss, a bit of refactoring