applying error and success alerts