PSTAlertController support

Support for PSTAlertController. Refactor some code too.