Added dismiss method to dismiss modally presented view controllers