account settings: link to new lrc

This patch use new lrc to manage account settings and refactor
account ui. Due to the changes next views were removed:
-AccountsVC
-AccMediaVC
-AccDevicesVC
-AccSecurityVC
-AccRingVC

Change-Id: I08ddfc7be3bc2d71d646c8f18cf3d1980378142c
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
diff --git a/src/AccGeneralVC.h b/src/AccAdvancedRingVC.h
similarity index 79%
rename from src/AccGeneralVC.h
rename to src/AccAdvancedRingVC.h
index 2a7ec82..b05a489 100644
--- a/src/AccGeneralVC.h
+++ b/src/AccAdvancedRingVC.h
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -18,11 +19,8 @@
  */
 
 #import <Cocoa/Cocoa.h>
+#import "AccAdvancedVC.h"
 
-#import <account.h>
-
-@interface AccGeneralVC : NSViewController <NSTextFieldDelegate> {
-
-}
+@interface AccAdvancedRingVC : AccAdvancedVC <NSTextFieldDelegate>
 
 @end
diff --git a/src/AccAdvancedRingVC.mm b/src/AccAdvancedRingVC.mm
new file mode 100644
index 0000000..703e109
--- /dev/null
+++ b/src/AccAdvancedRingVC.mm
@@ -0,0 +1,122 @@
+/*
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+#import "AccAdvancedRingVC.h"
+
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <api/newdevicemodel.h>
+
+@interface AccAdvancedRingVC () {
+    __unsafe_unretained IBOutlet NSButton *allowIncoming;
+    __unsafe_unretained IBOutlet NSTextField *nameServerField;
+    __unsafe_unretained IBOutlet NSTextField *proxyServerField;
+    __unsafe_unretained IBOutlet NSTextField *bootstrapServerField;
+    __unsafe_unretained IBOutlet NSButton *enableProxyButton;
+}
+@end
+
+@implementation AccAdvancedRingVC
+
+//Tags for views
+const NSInteger  NAME_SERVER_TAG         = 100;
+const NSInteger  PROXY_SERVER_TAG        = 200;
+const NSInteger  BOOTSTRAP_SERVER_TAG    = 300;
+
+-(void) updateView {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    [allowIncoming setState: accountProperties.allowIncoming];
+    [nameServerField setStringValue: @(accountProperties.RingNS.uri.c_str())];
+    [proxyServerField setStringValue:@(accountProperties.proxyServer.c_str())];
+    [bootstrapServerField setStringValue:@(accountProperties.hostname.c_str())];
+    [enableProxyButton setState: accountProperties.proxyEnabled];
+    [proxyServerField setEditable:accountProperties.proxyEnabled];
+}
+
+-(void) viewDidLoad {
+    [super viewDidLoad];
+    [self updateView];
+}
+
+- (void) setSelectedAccount:(std::string) account {
+    [super setSelectedAccount: account];
+    [self updateView];
+}
+
+#pragma mark - Actions
+
+- (IBAction)allowCallFromUnknownPeer:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.allowIncoming != [sender state]) {
+        accountProperties.allowIncoming = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+
+- (IBAction)enableProxy:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.proxyEnabled != [sender state]) {
+        accountProperties.proxyEnabled = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+    [proxyServerField setEditable:[sender state]];
+}
+
+- (IBAction) valueDidChange: (id) sender
+{
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+
+    switch ([sender tag]) {
+        case NAME_SERVER_TAG:
+            if(accountProperties.RingNS.uri != [[sender stringValue] UTF8String]) {
+                accountProperties.RingNS.uri = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            return;
+        case PROXY_SERVER_TAG:
+            if(accountProperties.proxyServer != [[sender stringValue] UTF8String]) {
+                accountProperties.proxyServer = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            return;
+        case BOOTSTRAP_SERVER_TAG:
+            if(accountProperties.hostname != [[sender stringValue] UTF8String]) {
+                accountProperties.hostname = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            return;
+        default:
+            break;
+    }
+
+    [super valueDidChange:sender];
+}
+
+#pragma mark - NSTextFieldDelegate methods
+
+-(void)controlTextDidChange:(NSNotification *)notif
+{
+    NSTextField *textField = [notif object];
+    NSRange test = [[textField currentEditor] selectedRange];
+
+    [self valueDidChange:textField];
+}
+
+@end
diff --git a/src/AccGeneralVC.h b/src/AccAdvancedSipVC.h
similarity index 79%
copy from src/AccGeneralVC.h
copy to src/AccAdvancedSipVC.h
index 2a7ec82..3982405 100644
--- a/src/AccGeneralVC.h
+++ b/src/AccAdvancedSipVC.h
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,10 +20,8 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <account.h>
+#import "AccAdvancedVC.h"
 
-@interface AccGeneralVC : NSViewController <NSTextFieldDelegate> {
-
-}
+@interface AccAdvancedSipVC : AccAdvancedVC <NSTextFieldDelegate>
 
 @end
diff --git a/src/AccAdvancedSipVC.mm b/src/AccAdvancedSipVC.mm
new file mode 100644
index 0000000..8f11e97
--- /dev/null
+++ b/src/AccAdvancedSipVC.mm
@@ -0,0 +1,363 @@
+/*
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+#define OUTGOING_TLS_SERVER_TAG 0
+#define NEGOTIATION_TIMOUT_TAG 1
+#define REGISTRATION_TAG 2
+#define LOCALPORT_TAG 3
+#define CUSTOM_PORT_TAG 4
+#define CUSTOM_ADDRESS_TAG 5
+#define MINAUDIO_TAG 6
+#define MAXAUDIO_TAG 7
+#define MINVIDEO_TAG 8
+#define MAXVIDEO_TAG 9
+
+#import "AccAdvancedSipVC.h"
+
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+
+@interface AccAdvancedSipVC () {
+    __unsafe_unretained IBOutlet NSButton *encryptMediaButton;
+    __unsafe_unretained IBOutlet NSButton *enableSDESButton;
+    __unsafe_unretained IBOutlet NSButton *fallbackEncryptionFailureButton;
+    __unsafe_unretained IBOutlet NSButton *encryptNegotiationButton;
+    __unsafe_unretained IBOutlet NSButton *checkIncomingCertificatesButton;
+    __unsafe_unretained IBOutlet NSButton *checkAnswerCertificatesButton;
+    __unsafe_unretained IBOutlet NSButton *requereIncomingCertificateButton;
+    __unsafe_unretained IBOutlet NSPopUpButton *tlsProtocolsList;
+    __unsafe_unretained IBOutlet NSTextField *outgoingTlsServerNameField;
+    __unsafe_unretained IBOutlet NSStepper *negotiationTimeoutStepper;
+    __unsafe_unretained IBOutlet NSTextField *negotiationTimeoutField;
+    __unsafe_unretained IBOutlet NSStepper *registrationTimeoutStepper;
+    __unsafe_unretained IBOutlet NSTextField *registrationTimeoutField;
+    __unsafe_unretained IBOutlet NSStepper *networkStepper;
+    __unsafe_unretained IBOutlet NSTextField *networkField;
+    __unsafe_unretained IBOutlet NSTextField *customAddressField;
+    __unsafe_unretained IBOutlet NSButton *useCustomAddressButton;
+    __unsafe_unretained IBOutlet NSStepper *customPortStepper;
+    __unsafe_unretained IBOutlet NSTextField *customPortField;
+    __unsafe_unretained IBOutlet NSStepper *minAudioPortStepper;
+    __unsafe_unretained IBOutlet NSStepper *maxAudioPortStepper;
+    __unsafe_unretained IBOutlet NSStepper *minVideoPortStepper;
+    __unsafe_unretained IBOutlet NSStepper *maxVideoPortStepper;
+    __unsafe_unretained IBOutlet NSTextField *minAudioRTPRange;
+    __unsafe_unretained IBOutlet NSTextField *maxAudioRTPRange;
+    __unsafe_unretained IBOutlet NSTextField *minVideoRTPRange;
+    __unsafe_unretained IBOutlet NSTextField *maxVideoRTPRange;
+}
+
+@end
+
+@implementation AccAdvancedSipVC
+
+NSString *TLS_PROTOCOL_DEFAULT = @"Default";
+NSString *TLS_PROTOCOL_TLSv1 = @"TLSv1";
+NSString *TLS_PROTOCOL_TLSv1_1 = @"TLSv1_1";
+NSString *TLS_PROTOCOL_TLSv1_2 = @"TLSv1_2";
+
+@synthesize privateKeyPaswordField;
+@synthesize selectCACertificateButton, selectUserCertificateButton, selectPrivateKeyButton;
+
+- (void)awakeFromNib
+{
+    [super awakeFromNib];
+    [negotiationTimeoutStepper setTag:NEGOTIATION_TIMOUT_TAG];
+    [negotiationTimeoutField setTag:NEGOTIATION_TIMOUT_TAG];
+    [registrationTimeoutStepper setTag:REGISTRATION_TAG];
+    [registrationTimeoutField setTag:REGISTRATION_TAG];
+    [networkStepper setTag:LOCALPORT_TAG];
+    [networkField setTag:LOCALPORT_TAG];
+    [customAddressField setTag: CUSTOM_ADDRESS_TAG];
+    [outgoingTlsServerNameField setTag: OUTGOING_TLS_SERVER_TAG];
+    [customPortStepper setTag: CUSTOM_PORT_TAG];
+    [customPortField setTag: CUSTOM_PORT_TAG];
+    [minAudioPortStepper setTag:MINAUDIO_TAG];
+    [maxAudioPortStepper setTag:MAXAUDIO_TAG];
+    [minVideoPortStepper setTag:MINVIDEO_TAG];
+    [maxVideoPortStepper setTag:MAXVIDEO_TAG];
+    [minAudioRTPRange setTag:MINAUDIO_TAG];
+    [maxAudioRTPRange setTag:MAXAUDIO_TAG];
+    [minVideoRTPRange setTag:MINVIDEO_TAG];
+    [maxVideoRTPRange setTag:MAXVIDEO_TAG];
+}
+
+-(void)viewDidLoad {
+    [super viewDidLoad];
+    NSMenu *tlsMethods = [[NSMenu alloc] initWithTitle:@""];
+    [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_DEFAULT action:nil keyEquivalent:@""]];
+    [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1 action:nil keyEquivalent:@""]];
+    [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1_1 action:nil keyEquivalent:@""]];
+    [tlsMethods addItem: [[NSMenuItem alloc] initWithTitle: TLS_PROTOCOL_TLSv1_2 action:nil keyEquivalent:@""]];
+    tlsProtocolsList.menu = tlsMethods;
+    [self updateView];
+}
+
+- (void) setSelectedAccount:(std::string) account {
+    [super setSelectedAccount: account];
+    [self updateView];
+}
+
+- (void) updateView {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    [encryptMediaButton setState: accountProperties.SRTP.enable];
+    [enableSDESButton setState: accountProperties.SRTP.keyExchange == lrc::api::account::KeyExchangeProtocol::SDES ? NSControlStateValueOn : NSControlStateValueOff];
+    [fallbackEncryptionFailureButton setState: accountProperties.SRTP.rtpFallback];
+    [encryptNegotiationButton setState: accountProperties.TLS.enable];
+    [selectCACertificateButton setEnabled: accountProperties.TLS.enable];
+    [selectUserCertificateButton setEnabled: accountProperties.TLS.enable];
+    [selectPrivateKeyButton setEnabled: accountProperties.TLS.enable];
+    [privateKeyPaswordField setEnabled: accountProperties.TLS.enable];
+    [checkIncomingCertificatesButton setState: accountProperties.TLS.verifyServer];
+    [checkAnswerCertificatesButton setState: accountProperties.TLS.verifyClient];
+    [requereIncomingCertificateButton setState: accountProperties.TLS.requireClientCertificate];
+    switch (accountProperties.TLS.method) {
+        case lrc::api::account::TlsMethod::DEFAULT:
+            [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_DEFAULT];
+            break;
+        case lrc::api::account::TlsMethod::TLSv1:
+            [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1];
+            break;
+        case lrc::api::account::TlsMethod::TLSv1_1:
+            [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1_1];
+            break;
+        case lrc::api::account::TlsMethod::TLSv1_2:
+            [tlsProtocolsList selectItemWithTitle:TLS_PROTOCOL_TLSv1_2];
+            break;
+
+        default:
+            break;
+    }
+    [negotiationTimeoutStepper setIntegerValue: accountProperties.TLS.negotiationTimeoutSec];
+    [negotiationTimeoutField setIntegerValue: accountProperties.TLS.negotiationTimeoutSec];
+    [registrationTimeoutStepper setIntegerValue: accountProperties.Registration.expire];
+    [registrationTimeoutField setIntegerValue: accountProperties.Registration.expire];
+    [networkStepper setIntegerValue: accountProperties.localPort];
+    [networkField setIntegerValue: accountProperties.localPort];
+    [customAddressField setEnabled:!accountProperties.publishedSameAsLocal];
+    [customPortField setEnabled:!accountProperties.publishedSameAsLocal];
+    [customPortStepper setEnabled:!accountProperties.publishedSameAsLocal];
+    [useCustomAddressButton setState:!accountProperties.publishedSameAsLocal];
+    [customPortStepper setIntegerValue: accountProperties.publishedPort];
+    [customPortField setIntegerValue: accountProperties.publishedPort];
+    [customAddressField setStringValue: @(accountProperties.publishedAddress.c_str())];
+    [minAudioPortStepper setIntegerValue: accountProperties.Audio.audioPortMin];
+    [minAudioRTPRange setIntegerValue: accountProperties.Audio.audioPortMin];
+    [maxAudioPortStepper setIntegerValue: accountProperties.Audio.audioPortMax];
+    [maxAudioRTPRange setIntegerValue: accountProperties.Audio.audioPortMax];
+    [minVideoPortStepper setIntegerValue: accountProperties.Video.videoPortMin];
+    [minVideoRTPRange setIntegerValue: accountProperties.Video.videoPortMin];
+    [maxVideoPortStepper setIntegerValue: accountProperties.Video.videoPortMin];
+    [maxVideoRTPRange setIntegerValue: accountProperties.Video.videoPortMin];
+}
+
+#pragma mark - Actions
+
+- (IBAction)toggleEnableSDES:(id)sender {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    lrc::api::account::KeyExchangeProtocol newState = [sender state] == NSControlStateValueOn ? lrc::api::account::KeyExchangeProtocol::SDES : lrc::api::account::KeyExchangeProtocol::NONE;
+    if(accountProperties.SRTP.keyExchange != newState) {
+        accountProperties.SRTP.keyExchange = newState;
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+- (IBAction)toggleEncryptMedia:(id)sender {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.SRTP.enable!= [sender state]) {
+        accountProperties.SRTP.enable = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+- (IBAction)toggleFallbackEncryptionFailure:(id)sender {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.SRTP.rtpFallback != [sender state]) {
+        accountProperties.SRTP.rtpFallback = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+- (IBAction)toggleEncryptNegotiation:(id)sender {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.TLS.enable != [sender state]) {
+        accountProperties.TLS.enable = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [selectCACertificateButton setEnabled: [sender state]];
+        [selectUserCertificateButton setEnabled: [sender state]];
+        [selectPrivateKeyButton setEnabled: [sender state]];
+        [privateKeyPaswordField setEnabled: [sender state]];
+    }
+}
+- (IBAction)toggleVerifyServerCertificate:(id)sender {
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.TLS.verifyServer != [sender state]) {
+        accountProperties.TLS.verifyServer = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+- (IBAction)toggleVerifyClientCertificate:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.TLS.verifyClient != [sender state]) {
+        accountProperties.TLS.verifyClient = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+- (IBAction)toggleCertForIncomingConnection:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.TLS.requireClientCertificate != [sender state]) {
+        accountProperties.TLS.requireClientCertificate = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+
+- (IBAction)enableCustomAddress:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.publishedSameAsLocal != ![sender state]) {
+        accountProperties.publishedSameAsLocal = ![sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [customAddressField setEnabled:[sender state]];
+        [customPortField setEnabled:[sender state]];
+        [customPortStepper setEnabled:[sender state]];
+    }
+}
+
+- (IBAction)chooseTlsProtocol:(id)sender {
+    int index = [sender indexOfSelectedItem];
+    if(index < 0) {
+        return;
+    }
+    NSString *title = [[tlsProtocolsList.menu itemAtIndex:index] title];
+    lrc::api::account::TlsMethod method;
+
+    if(title == TLS_PROTOCOL_DEFAULT) {
+        method = lrc::api::account::TlsMethod::DEFAULT;
+    } else if(title == TLS_PROTOCOL_TLSv1) {
+        method = lrc::api::account::TlsMethod::TLSv1;
+    } else if(title == TLS_PROTOCOL_TLSv1_1) {
+        method = lrc::api::account::TlsMethod::TLSv1_1;
+    } else if(title == TLS_PROTOCOL_TLSv1_2) {
+        method = lrc::api::account::TlsMethod::TLSv1_2;
+    } else {
+        return;
+    }
+    auto accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.TLS.method != method) {
+        accountProperties.TLS.method = method;
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+
+- (IBAction) valueDidChange: (id) sender
+{
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+
+    switch ([sender tag]) {
+        case OUTGOING_TLS_SERVER_TAG:
+            if(accountProperties.TLS.serverName != [[sender stringValue] UTF8String]) {
+                accountProperties.TLS.serverName = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            return;
+        case NEGOTIATION_TIMOUT_TAG:
+            if(accountProperties.TLS.negotiationTimeoutSec != [[sender stringValue] integerValue]) {
+                accountProperties.TLS.negotiationTimeoutSec = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [negotiationTimeoutStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [negotiationTimeoutField setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case REGISTRATION_TAG:
+            if(accountProperties.Registration.expire != [[sender stringValue] integerValue]) {
+                accountProperties.Registration.expire = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [registrationTimeoutStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [registrationTimeoutField setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case LOCALPORT_TAG:
+            if(accountProperties.localPort != [[sender stringValue] integerValue]) {
+                accountProperties.localPort = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [networkStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [networkField setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case CUSTOM_ADDRESS_TAG:
+            if(accountProperties.publishedAddress != [[sender stringValue] UTF8String]) {
+                NSString *name = [sender stringValue];
+                accountProperties.publishedAddress = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            return;
+        case CUSTOM_PORT_TAG:
+            if(accountProperties.publishedPort != [[sender stringValue] integerValue]) {
+                accountProperties.publishedPort = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [customPortStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [customPortField setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case MINAUDIO_TAG:
+            if(accountProperties.Audio.audioPortMin != [[sender stringValue] integerValue]) {
+                accountProperties.Audio.audioPortMin = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [minAudioPortStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [minAudioRTPRange setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case MAXAUDIO_TAG:
+            if(accountProperties.Audio.audioPortMax != [[sender stringValue] integerValue]) {
+                accountProperties.Audio.audioPortMax = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [maxAudioPortStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [maxAudioRTPRange setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case MINVIDEO_TAG:
+            if(accountProperties.Video.videoPortMin != [[sender stringValue] integerValue]) {
+                accountProperties.Video.videoPortMin = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [minVideoPortStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [minVideoRTPRange setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        case MAXVIDEO_TAG:
+            if(accountProperties.Video.videoPortMax != [[sender stringValue] integerValue]) {
+                accountProperties.Video.videoPortMax = [[sender stringValue] integerValue];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [maxVideoPortStepper setIntegerValue: [[sender stringValue] integerValue]];
+                [maxVideoRTPRange setIntegerValue: [[sender stringValue] integerValue]];
+            }
+            return;
+        default:
+            break;
+    }
+    [super valueDidChange:sender];
+}
+
+#pragma mark - NSTextFieldDelegate methods
+
+-(void)controlTextDidChange:(NSNotification *)notif
+{
+    NSTextField *textField = [notif object];
+    NSRange test = [[textField currentEditor] selectedRange];
+
+    [self valueDidChange:textField];
+}
+
+@end
diff --git a/src/AccAdvancedVC.h b/src/AccAdvancedVC.h
index f6b132d..86709bd 100644
--- a/src/AccAdvancedVC.h
+++ b/src/AccAdvancedVC.h
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,8 +20,21 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <account.h>
+#import "LrcModelsProtocol.h"
+#include <string>
 
-@interface AccAdvancedVC : NSViewController <NSTextFieldDelegate>
+@protocol AccountAdvancedProtocol
+- (void) setSelectedAccount:(std::string) account;
+@end
+
+@interface AccAdvancedVC : NSViewController <NSTableViewDataSource, NSTableViewDelegate, AccountAdvancedProtocol, LrcModelsProtocol>
+
+@property std::string selectedAccountID;
+@property (unsafe_unretained) IBOutlet NSButton* selectCACertificateButton;
+@property (unsafe_unretained) IBOutlet NSButton* selectUserCertificateButton;
+@property (unsafe_unretained) IBOutlet NSButton* selectPrivateKeyButton;
+@property (unsafe_unretained) IBOutlet NSSecureTextField *privateKeyPaswordField;
+
+- (IBAction) valueDidChange: (id) sender;
 
 @end
diff --git a/src/AccAdvancedVC.mm b/src/AccAdvancedVC.mm
index e1d2592..39dc7e9 100644
--- a/src/AccAdvancedVC.mm
+++ b/src/AccAdvancedVC.mm
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -16,288 +17,446 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
  */
-#define REGISTRATION_TAG 0
-#define LOCALPORT_TAG 1
-#define STUNURL_TAG 2
-#define PUBLICADDR_TAG 3
-#define PUBLICPORT_TAG 4
-#define MINAUDIO_TAG 5
-#define MAXAUDIO_TAG 6
-#define MINVIDEO_TAG 7
-#define MAXVIDEO_TAG 8
-
-#define TURN_SERVER_TAG     9
-#define TURN_USERNAME_TAG   10
-#define TURN_PASSWORD_TAG   11
-#define TURN_REALM_TAG      12
-
 #import "AccAdvancedVC.h"
 
-///Qt
-#import <qitemselectionmodel.h>
-
-///LRC
-#import <accountmodel.h>
-#import <credentialmodel.h>
-#import <credential.h>
-
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <api/newdevicemodel.h>
+#import <api/newcodecmodel.h>
+#import <account.h>
 
 @interface AccAdvancedVC ()
-@property (unsafe_unretained) IBOutlet NSView *registrationContainer;
-@property (unsafe_unretained) IBOutlet NSView *mainContainer;
 
-@property (unsafe_unretained) IBOutlet NSTextField *registrationField;
-@property (unsafe_unretained) IBOutlet NSTextField *localPortField;
-@property (unsafe_unretained) IBOutlet NSButton *isUsingSTUN;
-
-@property (unsafe_unretained) IBOutlet NSTextField *STUNserverURLField;
-@property (unsafe_unretained) IBOutlet NSTextField *minAudioRTPRange;
-@property (unsafe_unretained) IBOutlet NSTextField *maxAudioRTPRange;
-@property (unsafe_unretained) IBOutlet NSTextField *minVideoRTPRange;
-@property (unsafe_unretained) IBOutlet NSTextField *maxVideoRTPRange;
-
-@property (unsafe_unretained) IBOutlet NSButton *isUsingTURN;
-@property (unsafe_unretained) IBOutlet NSTextField *turnServerURL;
-@property (unsafe_unretained) IBOutlet NSTextField *turnUsername;
-@property (unsafe_unretained) IBOutlet NSSecureTextField *turnPassword;
-@property (unsafe_unretained) IBOutlet NSTextField *turnRealm;
-
-@property (unsafe_unretained) IBOutlet NSStepper *registrationStepper;
-@property (unsafe_unretained) IBOutlet NSStepper *localPortStepper;
-@property (unsafe_unretained) IBOutlet NSStepper *minAudioPortStepper;
-@property (unsafe_unretained) IBOutlet NSStepper *maxAudioPortStepper;
-@property (unsafe_unretained) IBOutlet NSStepper *minVideoPortStepper;
-@property (unsafe_unretained) IBOutlet NSStepper *maxVideoPortStepper;
-
-@property (unsafe_unretained) IBOutlet NSMatrix *publishAddrAndPortRadioGroup;
-@property (unsafe_unretained) IBOutlet NSTextField *publishedAddrField;
-@property (unsafe_unretained) IBOutlet NSTextField *publishedPortField;
+@property (unsafe_unretained) IBOutlet NSButton* ringtoneSelectionButton;
+@property (unsafe_unretained) IBOutlet NSButton* enableRingtone;
+@property (unsafe_unretained) IBOutlet NSButton* autoAnswer;
+@property (unsafe_unretained) IBOutlet NSButton* toggleUPnPButton;
+@property (unsafe_unretained) IBOutlet NSButton* useTURNButton;
+@property (unsafe_unretained) IBOutlet NSButton* useSTUNButton;
+@property (unsafe_unretained) IBOutlet NSButton *toggleVideoButton;
+@property (unsafe_unretained) IBOutlet NSTableView* audioCodecView;
+@property (unsafe_unretained) IBOutlet NSTableView* videoCodecView;
+@property (unsafe_unretained) IBOutlet NSTextField *turnAddressField;
+@property (unsafe_unretained) IBOutlet NSTextField *turnUsernameField;
+@property (unsafe_unretained) IBOutlet NSSecureTextField *turnPasswordField;
+@property (unsafe_unretained) IBOutlet NSTextField *turnRealmField;
+@property (unsafe_unretained) IBOutlet NSTextField *stunAddressField;
+@property (unsafe_unretained) IBOutlet NSButton *disableVideoButton;
 
 @end
 
 @implementation AccAdvancedVC
-@synthesize registrationField;
-@synthesize localPortField;
-@synthesize isUsingSTUN;
-@synthesize STUNserverURLField;
-@synthesize minAudioRTPRange;
-@synthesize maxAudioRTPRange;
-@synthesize minVideoRTPRange;
-@synthesize maxVideoRTPRange;
-@synthesize registrationStepper;
-@synthesize localPortStepper;
-@synthesize turnPassword, isUsingTURN, turnRealm, turnServerURL, turnUsername;
-@synthesize minAudioPortStepper;
-@synthesize maxAudioPortStepper;
-@synthesize minVideoPortStepper;
-@synthesize maxVideoPortStepper;
-@synthesize publishAddrAndPortRadioGroup;
-@synthesize publishedAddrField;
-@synthesize publishedPortField;
+
+@synthesize audioCodecView, videoCodecView;
+@synthesize privateKeyPaswordField, turnAddressField, turnUsernameField, turnPasswordField, turnRealmField, stunAddressField;
+@synthesize ringtoneSelectionButton, selectCACertificateButton, selectUserCertificateButton, selectPrivateKeyButton;
+@synthesize enableRingtone, toggleVideoButton, autoAnswer, toggleUPnPButton, useTURNButton, useSTUNButton, disableVideoButton;
+@synthesize accountModel;
+
+NS_ENUM(NSInteger, ButtonsTags) {
+    TAG_RINGTONE = 1,
+    TAG_CA_CERTIFICATE,
+    TAG_USER_CERTIFICATE,
+    TAG_PRIVATE_KEY
+};
+
+NS_ENUM(NSInteger, TextFieldsViews) {
+    PRIVATE_KEY_PASSWORG_TAG = 1,
+    TURN_ADDRESS_TAG,
+    TURN_USERNAME_TAG,
+    TURN_PASSWORD_TAG,
+    TURN_REALM_TAG,
+    STUN_ADDRESS_TAG
+};
+
+NS_ENUM(NSInteger, tablesViews) {
+    AUDIO_CODEC_NAME_TAG = 1,
+    AUDIO_CODEC_SAMPLERATE_TAG,
+    AUDIO_CODEC_ENABLE_TAG,
+    VIDEO_CODEC_NAME_TAG,
+    VIDIO_CODEC_ENABLE_TAG
+};
+
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
+{
+    if (self =  [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
+}
 
 - (void)awakeFromNib
 {
-    NSLog(@"INIT Advanced VC");
-    [registrationStepper setTag:REGISTRATION_TAG];
-    [localPortStepper setTag:LOCALPORT_TAG];
-    [minAudioPortStepper setTag:MINAUDIO_TAG];
-    [maxAudioPortStepper setTag:MAXAUDIO_TAG];
-    [minVideoPortStepper setTag:MINVIDEO_TAG];
-    [maxVideoPortStepper setTag:MAXVIDEO_TAG];
-
-    [turnServerURL setTag:TURN_SERVER_TAG];
-    [turnUsername setTag:TURN_USERNAME_TAG];
-    [turnPassword setTag:TURN_PASSWORD_TAG];
-    [turnRealm setTag:TURN_REALM_TAG];
-
-    [registrationField setTag:REGISTRATION_TAG];
-    [localPortField setTag:LOCALPORT_TAG];
-    [minAudioRTPRange setTag:MINAUDIO_TAG];
-    [maxAudioRTPRange setTag:MAXAUDIO_TAG];
-    [minVideoRTPRange setTag:MINVIDEO_TAG];
-    [maxVideoRTPRange setTag:MAXVIDEO_TAG];
-
-    [STUNserverURLField setTag:STUNURL_TAG];
-    [publishedPortField setTag:PUBLICPORT_TAG];
-    [publishedAddrField setTag:PUBLICADDR_TAG];
-
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-
+    [super awakeFromNib];
+    audioCodecView.delegate = self;
+    audioCodecView.dataSource = self;
+    videoCodecView.delegate = self;
+    videoCodecView.dataSource = self;
+    [disableVideoButton setWantsLayer:YES];
+    disableVideoButton.layer.backgroundColor = [[NSColor colorWithRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:0.3] CGColor];
+    [self setTags];
 }
 
-- (Account*) currentAccount
-{
-    auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
-    return AccountModel::instance().getAccountByModelIndex(accIdx);
+-(void) setTags {
+    [ringtoneSelectionButton setTag: TAG_RINGTONE];
+    [selectCACertificateButton setTag: TAG_CA_CERTIFICATE];
+    [selectUserCertificateButton setTag: TAG_USER_CERTIFICATE];
+    [selectPrivateKeyButton setTag: TAG_PRIVATE_KEY];
+    [privateKeyPaswordField setTag: PRIVATE_KEY_PASSWORG_TAG];
+    [turnAddressField setTag: TURN_ADDRESS_TAG];
+    [turnUsernameField setTag: TURN_USERNAME_TAG];
+    [turnPasswordField setTag: TURN_PASSWORD_TAG];
+    [turnRealmField setTag: TURN_REALM_TAG];
+    [stunAddressField setTag: STUN_ADDRESS_TAG];
 }
 
-- (void)loadAccount
-{
-    auto account = [self currentAccount];
+-(void) update {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    [ringtoneSelectionButton setTitle: [@(accountProperties.Ringtone.ringtonePath.c_str()) lastPathComponent]];
+    [enableRingtone setState :accountProperties.Ringtone.ringtoneEnabled];
+    [autoAnswer setState: accountProperties.autoAnswer];
+    [selectPrivateKeyButton setTitle: [@(accountProperties.TLS.privateKeyFile.c_str()) lastPathComponent]];
+    [selectUserCertificateButton setTitle:[@(accountProperties.TLS.certificateFile.c_str()) lastPathComponent]];
+    [selectCACertificateButton setTitle: [@(accountProperties.TLS.certificateListFile.c_str()) lastPathComponent]];
+    [toggleUPnPButton setState:accountProperties.upnpEnabled];
+    [useTURNButton setState:accountProperties.TURN.enable];
+    [useSTUNButton setState:accountProperties.STUN.enable];
+    [privateKeyPaswordField setStringValue:@(accountProperties.TLS.password.c_str())];
+    [turnAddressField setStringValue:@(accountProperties.TURN.server.c_str())];
+    [turnUsernameField setStringValue:@(accountProperties.TURN.username.c_str())];
+    [turnPasswordField setStringValue:@(accountProperties.TURN.password.c_str())];
+    [turnRealmField setStringValue:@(accountProperties.TURN.realm.c_str())];
+    [stunAddressField setStringValue:@(accountProperties.STUN.server.c_str())];
+    [stunAddressField setEditable:accountProperties.STUN.enable];
+    [turnAddressField setEditable:accountProperties.TURN.enable];
+    [turnUsernameField setEditable:accountProperties.TURN.enable];
+    [turnPasswordField setEditable:accountProperties.TURN.enable];
+    [turnRealmField setEditable:accountProperties.TURN.enable];
+    [disableVideoButton setHidden:accountProperties.Video.videoEnabled];
+    [toggleVideoButton setState:accountProperties.Video.videoEnabled];
+    [videoCodecView setEnabled:accountProperties.Video.videoEnabled];
+    [audioCodecView reloadData];
+    [videoCodecView reloadData];
+}
 
-    [self updateControlsWithTag:REGISTRATION_TAG];
-    [self updateControlsWithTag:LOCALPORT_TAG];
-    [self updateControlsWithTag:MINAUDIO_TAG];
-    [self updateControlsWithTag:MAXAUDIO_TAG];
-    [self updateControlsWithTag:MINVIDEO_TAG];
-    [self updateControlsWithTag:MAXVIDEO_TAG];
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [self update];
+}
 
-    [STUNserverURLField setStringValue:account->sipStunServer().toNSString()];
-    [isUsingSTUN setState:account->isSipStunEnabled()?NSOnState:NSOffState];
-    [STUNserverURLField setEnabled:account->isSipStunEnabled()];
+#pragma mark - AccountAdvancedProtocol methods
 
-    [isUsingTURN setState:account->isTurnEnabled()?NSOnState:NSOffState];
-    [self toggleTURN:isUsingTURN];
-    [turnServerURL setStringValue:account->turnServer().toNSString()];
+- (void) setSelectedAccount:(std::string) account {
+    self.selectedAccountID = account;
+    [self update];
+}
 
-    auto turnCreds = account->credentialModel()->primaryCredential(Credential::Type::TURN);
+#pragma mark - Actions
 
-    [turnUsername setStringValue:turnCreds->username().toNSString()];
-    [turnPassword setStringValue:turnCreds->password().toNSString()];
-    [turnRealm setStringValue:turnCreds->realm().toNSString()];
-
-    if(account->isPublishedSameAsLocal())
-        [publishAddrAndPortRadioGroup selectCellAtRow:0 column:0];
-    else {
-        [publishAddrAndPortRadioGroup selectCellAtRow:1 column:0];
-    }
-
-    [publishedAddrField setStringValue:account->publishedAddress().toNSString()];
-    [publishedPortField setIntValue:account->publishedPort()];
-    [publishedAddrField setEnabled:!account->isPublishedSameAsLocal()];
-    [publishedPortField setEnabled:!account->isPublishedSameAsLocal()];
-
-    if(account->protocol() == Account::Protocol::RING) {
-        [self.registrationContainer setHidden:YES];
-    } else {
-        [self.registrationContainer setHidden:NO];
+- (IBAction)autoAnswerCall:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if( accountProperties.autoAnswer != [sender state]) {
+        accountProperties.autoAnswer = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
     }
 }
 
-#pragma mark - NSTextFieldDelegate methods
-
--(void)controlTextDidChange:(NSNotification *)notif
-{
-    NSTextField *textField = [notif object];
-    NSRange test = [[textField currentEditor] selectedRange];
-
-    [self valueDidChange:textField];
-    //FIXME: saving account lose focus because in NSTreeController we remove and reinsert row so View selection change
-    [textField.window makeFirstResponder:textField];
-    [[textField currentEditor] setSelectedRange:test];
+- (IBAction)autoEnableRingtone:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.Ringtone.ringtoneEnabled != [sender state]) {
+        accountProperties.Ringtone.ringtoneEnabled = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [ringtoneSelectionButton setEnabled:[sender state]];
+    }
 }
 
-- (IBAction) valueDidChange: (id) sender
-{
+- (IBAction)togleUPnP:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if( accountProperties.upnpEnabled != [sender state]) {
+        accountProperties.upnpEnabled = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+    }
+}
+
+- (IBAction)useTURN:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if( accountProperties.TURN.enable != [sender state]) {
+        accountProperties.TURN.enable = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [turnAddressField setEditable:[sender state]];
+        [turnUsernameField setEditable:[sender state]];
+        [turnPasswordField setEditable:[sender state]];
+        [turnRealmField setEditable:[sender state]];
+    }
+}
+
+- (IBAction)useSTUN:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if( accountProperties.STUN.enable != [sender state]) {
+        accountProperties.STUN.enable = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [stunAddressField setEditable:[sender state]];
+    }
+}
+
+- (IBAction)selectFile:(id)sender {
+    NSOpenPanel *panel = [NSOpenPanel openPanel];
+    [panel setAllowsMultipleSelection:NO];
+    [panel setCanChooseDirectories:NO];
+    [panel setCanChooseFiles:YES];
+    if ([panel runModal] != NSFileHandlingPanelOKButton) return;
+    if ([[panel URLs] lastObject] == nil) return;
+    NSString * path = [[[panel URLs] lastObject] path];
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
     switch ([sender tag]) {
-        case REGISTRATION_TAG:
-            [self currentAccount]->setRegistrationExpire([sender integerValue]);
+        case TAG_RINGTONE:
+            if(accountProperties.Ringtone.ringtonePath != [path UTF8String]) {
+                accountProperties.Ringtone.ringtonePath = [path UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [ringtoneSelectionButton setTitle:[path lastPathComponent]];
+            }
             break;
-        case LOCALPORT_TAG:
-            [self currentAccount]->setLocalPort([sender integerValue]);
+        case TAG_CA_CERTIFICATE:
+            if(accountProperties.TLS.certificateListFile != [path UTF8String] ) {
+                accountProperties.TLS.certificateListFile = [path UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [selectCACertificateButton setTitle:[path lastPathComponent]];
+            }
             break;
-        case STUNURL_TAG:
-            [self currentAccount]->setSipStunServer([[sender stringValue] UTF8String]);
+        case TAG_USER_CERTIFICATE:
+            if(accountProperties.TLS.certificateFile != [path UTF8String] ) {
+                accountProperties.TLS.certificateFile = [path UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [selectUserCertificateButton setTitle:[path lastPathComponent]];
+            }
             break;
-        case PUBLICADDR_TAG:
-            [self currentAccount]->setPublishedAddress([[sender stringValue] UTF8String]);
+        case TAG_PRIVATE_KEY:
+            if(accountProperties.TLS.privateKeyFile != [path UTF8String] ) {
+                accountProperties.TLS.privateKeyFile = [path UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+                [selectPrivateKeyButton setTitle:[path lastPathComponent]];
+            }
             break;
-        case PUBLICPORT_TAG:
-            [self currentAccount]->setPublishedPort([sender integerValue]);
+    }
+}
+
+- (IBAction)valueDidChange:(id)sender
+{
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    switch ([sender tag]) {
+        case PRIVATE_KEY_PASSWORG_TAG:
+            if(accountProperties.TLS.password != [[sender stringValue] UTF8String]) {
+                accountProperties.TLS.password = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
             break;
-        case MINAUDIO_TAG:
-            [self currentAccount]->setAudioPortMin([sender integerValue]);
-            break;
-        case MAXAUDIO_TAG:
-            [self currentAccount]->setAudioPortMax([sender integerValue]);
-            break;
-        case MINVIDEO_TAG:
-            [self currentAccount]->setVideoPortMin([sender integerValue]);
-            break;
-        case MAXVIDEO_TAG:
-            [self currentAccount]->setVideoPortMax([sender integerValue]);
-            break;
-        case TURN_SERVER_TAG:
-            [self currentAccount]->setTurnServer([[sender stringValue] UTF8String]);
+        case TURN_ADDRESS_TAG:
+            if(accountProperties.TURN.server != [[sender stringValue] UTF8String]) {
+                accountProperties.TURN.server = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
             break;
         case TURN_USERNAME_TAG:
-            [self currentAccount]->credentialModel()->primaryCredential(Credential::Type::TURN)->setUsername([[sender stringValue] UTF8String]);
+            if(accountProperties.TURN.username != [[sender stringValue] UTF8String]) {
+                accountProperties.TURN.username = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
             break;
         case TURN_PASSWORD_TAG:
-            [self currentAccount]->credentialModel()->primaryCredential(Credential::Type::TURN)->setPassword([[sender stringValue] UTF8String]);
+            if(accountProperties.TURN.password != [[sender stringValue] UTF8String]) {
+                accountProperties.TURN.password = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
             break;
         case TURN_REALM_TAG:
-            [self currentAccount]->credentialModel()->primaryCredential(Credential::Type::TURN)->setRealm([[sender stringValue] UTF8String]);
+            if(accountProperties.TURN.realm != [[sender stringValue] UTF8String]) {
+                accountProperties.TURN.realm = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
+            break;
+        case STUN_ADDRESS_TAG:
+            if(accountProperties.STUN.server != [[sender stringValue] UTF8String]) {
+                accountProperties.STUN.server = [[sender stringValue] UTF8String];
+                self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+            }
             break;
         default:
             break;
     }
-    [self updateControlsWithTag:[sender tag]];
 }
 
-- (IBAction)toggleSTUN:(NSButton *)sender
-{
-    [self currentAccount]->setSipStunEnabled([sender state]);
-    [STUNserverURLField setEnabled:[self currentAccount]->isSipStunEnabled()];
-}
-
-- (IBAction)toggleTURN:(id)sender {
-    [self currentAccount]->setTurnEnabled([sender state]);
-    [turnServerURL setEnabled:[sender state]];
-    [turnUsername setEnabled:[sender state]];
-    [turnPassword setEnabled:[sender state]];
-    [turnRealm setEnabled:[sender state]];
-}
-
-- (IBAction)didSwitchPublishedAddress:(NSMatrix *)matrix
-{
-    NSInteger row = [matrix selectedRow];
-    if(row == 0) {
-        [self currentAccount]->setPublishedSameAsLocal(YES);
-    } else {
-        [self currentAccount]->setPublishedSameAsLocal(NO);
+- (IBAction)moveAudioCodecUp:(id)sender {
+    NSInteger row = [audioCodecView selectedRow];
+    if(row < 0) {
+        return;
     }
-    [publishedAddrField setEnabled:![self currentAccount]->isPublishedSameAsLocal()];
-    [publishedPortField setEnabled:![self currentAccount]->isPublishedSameAsLocal()];
-
+    auto audioCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getAudioCodecs();
+    auto codec = audioCodecs.begin();
+    std::advance(codec, row);
+    if (codec == audioCodecs.end()) {
+        return;
+    }
+    self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->increasePriority(codec->id, false);
+    [audioCodecView reloadData];
+    row = row == 0 ? row: row-1;
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex: row];
+    [audioCodecView selectRowIndexes:indexSet byExtendingSelection: NO];
+    [audioCodecView scrollRowToVisible:row];
 }
 
-- (void) updateControlsWithTag:(NSInteger) tag
-{
-    switch (tag) {
-        case REGISTRATION_TAG:
-            [registrationStepper setIntegerValue:[self currentAccount]->registrationExpire()];
-            [registrationField setIntegerValue:[self currentAccount]->registrationExpire()];
-            break;
-        case LOCALPORT_TAG:
-            [localPortStepper setIntegerValue:[self currentAccount]->localPort()];
-            [localPortField setIntegerValue:[self currentAccount]->localPort()];
-            break;
-        case MINAUDIO_TAG:
-            [minAudioPortStepper setIntegerValue:[self currentAccount]->audioPortMin()];
-            [minAudioRTPRange setIntegerValue:[self currentAccount]->audioPortMin()];
-            break;
-        case MAXAUDIO_TAG:
-            [maxAudioPortStepper setIntegerValue:[self currentAccount]->audioPortMax()];
-            [maxAudioRTPRange setIntegerValue:[self currentAccount]->audioPortMax()];
-            break;
-        case MINVIDEO_TAG:
-            [minVideoPortStepper setIntegerValue:[self currentAccount]->videoPortMin()];
-            [minVideoRTPRange setIntegerValue:[self currentAccount]->videoPortMin()];
-            break;
-        case MAXVIDEO_TAG:
-            [maxVideoPortStepper setIntegerValue:[self currentAccount]->videoPortMax()];
-            [maxVideoRTPRange setIntegerValue:[self currentAccount]->videoPortMax()];
-            break;
-        default:
-            break;
+- (IBAction)moveAudioCodecDown:(id)sender {
+    NSInteger row = [audioCodecView selectedRow];
+    if(row < 0) {
+        return;
     }
+    auto audioCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getAudioCodecs();
+    auto codec = audioCodecs.begin();
+    std::advance(codec, row);
+    if (codec == audioCodecs.end()) {
+        return;
+    }
+    self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->decreasePriority(codec->id, false);
+    [audioCodecView reloadData];
+    row = (row == ([audioCodecView numberOfRows] - 1)) ? row: row+1;
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex: row];
+    [audioCodecView selectRowIndexes:indexSet byExtendingSelection: NO];
+    [audioCodecView scrollRowToVisible:row];
+}
+
+- (IBAction)moveVideoCodecUp:(id)sender {
+    NSInteger row = [videoCodecView selectedRow];
+    if(row < 0) {
+        return;
+    }
+    auto videoCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getVideoCodecs();
+    auto codec = videoCodecs.begin();
+    std::advance(codec, row);
+    if (codec == videoCodecs.end()) {
+        return;
+    }
+    self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->increasePriority(codec->id, YES);
+    [videoCodecView reloadData];
+    row = row == 0 ? row: row-1;
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex: row];
+    [videoCodecView selectRowIndexes:indexSet byExtendingSelection: NO];
+    [videoCodecView scrollRowToVisible:row];
+}
+
+- (IBAction)moveVideoCodecDown:(id)sender {
+    NSInteger row = [videoCodecView selectedRow];
+    if(row < 0) {
+        return;
+    }
+    auto videoCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getVideoCodecs();
+    auto codec = videoCodecs.begin();
+    std::advance(codec, row);
+    if (codec == videoCodecs.end()) {
+        return;
+    }
+    self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->decreasePriority(codec->id, YES);
+    [videoCodecView reloadData];
+    row = row == [videoCodecView numberOfRows] - 1 ? row: row+1;
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex: row];
+    [videoCodecView selectRowIndexes:indexSet byExtendingSelection: NO];
+    [videoCodecView scrollRowToVisible:row];
+}
+
+- (IBAction)toggleVideoEnabled:(id)sender {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.Video.videoEnabled != [sender state]) {
+        accountProperties.Video.videoEnabled = [sender state];
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [videoCodecView setEnabled:[sender state]];
+        [videoCodecView reloadData];
+        [disableVideoButton setHidden:[sender state]];
+    }
+}
+
+- (IBAction)enableAudioCodec:(id)sender
+{
+    NSInteger row = [audioCodecView rowForView:sender];
+    if(row < 0) {
+        return;
+    }
+    auto audioCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getAudioCodecs();
+    auto codec = audioCodecs.begin();
+    std::advance(codec, row);
+    if (codec != audioCodecs.end() && codec->enabled != [sender state]) {
+        self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->enable(codec->id, [sender state]);
+    }
+}
+
+- (IBAction)enableVideoCodec:(id)sender
+{
+    NSInteger row = [videoCodecView rowForView:sender];
+    if(row < 0) {
+        return;
+    }
+    auto videoCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getVideoCodecs();
+    auto codec = videoCodecs.begin();
+    std::advance(codec, row);
+    if (codec != videoCodecs.end() && codec->enabled != [sender state]) {
+        self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->enable(codec->id, [sender state]);
+    }
+}
+
+#pragma mark - NSTableViewDelegate methods
+- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+    if(tableView == audioCodecView) {
+        NSTableCellView* audioCodecView = [tableView makeViewWithIdentifier:@"TableCellAudioCodecItem" owner:self];
+        NSTextField* nameLabel = [audioCodecView viewWithTag: AUDIO_CODEC_NAME_TAG];
+        NSTextField* samplerateLabel = [audioCodecView viewWithTag: AUDIO_CODEC_SAMPLERATE_TAG];
+        NSButton* codecEnableButton = [audioCodecView viewWithTag: AUDIO_CODEC_ENABLE_TAG];
+        auto audioCodecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getAudioCodecs();
+        auto codec = audioCodecs.begin();
+        std::advance(codec, row);
+        if (codec != audioCodecs.end()) {
+            [nameLabel setStringValue: @(codec->name.c_str())];
+            [samplerateLabel setStringValue: [@(codec->samplerate.c_str()) stringByAppendingString:@" Hz"]];
+            [codecEnableButton setState:codec->enabled];
+            [codecEnableButton setAction:@selector(enableAudioCodec:)];
+            [codecEnableButton setTarget:self];
+            return audioCodecView;
+        }
+    } else if (tableView == videoCodecView) {
+        NSTableCellView* videoCodecView = [tableView makeViewWithIdentifier:@"TableCellVideoCodecItem" owner:self];
+        NSTextField* nameLabel = [videoCodecView viewWithTag: VIDEO_CODEC_NAME_TAG];
+        NSButton* codecEnableButton = [audioCodecView viewWithTag: VIDIO_CODEC_ENABLE_TAG];
+        nameLabel.textColor = [tableView isEnabled] ? [NSColor labelColor] : [NSColor lightGrayColor];
+        [codecEnableButton setEnabled:[tableView isEnabled]];
+        auto codecs = self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getVideoCodecs();
+        auto codec = codecs.begin();
+        std::advance(codec, row);
+        if (codec != codecs.end()) {
+            [nameLabel setStringValue: @(codec->name.c_str())];
+            [codecEnableButton setState:codec->enabled];
+            [codecEnableButton setAction:@selector(enableVideoCodec:)];
+            [codecEnableButton setTarget:self];
+            return videoCodecView;
+        }
+    }
+}
+
+- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
+{
+    if(![tableView isEnabled]) {
+        return nil;
+    }
+    return [tableView makeViewWithIdentifier:@"HoverRowView" owner:nil];
+}
+
+#pragma mark - NSTableViewDataSource methods
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+    if(tableView == audioCodecView) {
+        return self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getAudioCodecs().size();
+    } else if (tableView == videoCodecView){
+        return self.accountModel->getAccountInfo(self.selectedAccountID).codecModel->getVideoCodecs().size();
+    }
+    return 0;
 }
 
 @end
diff --git a/src/AccDevicesVC.h b/src/AccDevicesVC.h
deleted file mode 100644
index 3ae4c2d..0000000
--- a/src/AccDevicesVC.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Copyright (C) 2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import <Cocoa/Cocoa.h>
-#import <account.h>
-@interface AccDevicesVC : NSViewController
-
-@property Account* account;
-
-@end
diff --git a/src/AccDevicesVC.mm b/src/AccDevicesVC.mm
deleted file mode 100644
index a712e88..0000000
--- a/src/AccDevicesVC.mm
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Copyright (C) 2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import "AccDevicesVC.h"
-
-//Qt
-#import <qitemselectionmodel.h>
-
-//LRC
-#import <accountmodel.h>
-#import <ringdevicemodel.h>
-#import <account.h>
-
-#import "QNSTreeController.h"
-#import "ExportPasswordWC.h"
-
-@interface AccDevicesVC () <ExportPasswordDelegate>
-
-@property QNSTreeController* devicesTreeController;
-@property ExportPasswordWC* passwordWC;
-
-@property (unsafe_unretained) IBOutlet NSOutlineView* deviceDetailsView;
-
-@end
-
-@implementation AccDevicesVC
-
-@synthesize passwordWC;
-
-NSInteger const TAG_NAME        =   100;
-NSInteger const TAG_DEVICE_IDS  =   200;
-
-- (void)awakeFromNib
-{
-    NSLog(@"INIT Devices VC");
-
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-}
-
-
-- (void)loadAccount
-{
-    auto account = AccountModel::instance().selectedAccount();
-    self.devicesTreeController = [[QNSTreeController alloc] initWithQModel:(QAbstractItemModel*)account->ringDeviceModel()];
-    [self.devicesTreeController setAvoidsEmptySelection:NO];
-    [self.devicesTreeController setChildrenKeyPath:@"children"];
-
-    [self.deviceDetailsView bind:@"content" toObject:self.devicesTreeController withKeyPath:@"arrangedObjects" options:nil];
-    [self.deviceDetailsView bind:@"sortDescriptors" toObject:self.devicesTreeController withKeyPath:@"sortDescriptors" options:nil];
-    [self.deviceDetailsView bind:@"selectionIndexPaths" toObject:self.devicesTreeController withKeyPath:@"selectionIndexPaths" options:nil];
-}
-
-- (IBAction)startExportOnRing:(id)sender
-{
-    NSButton* btbAdd = (NSButton *) sender;
-
-    self.account = AccountModel::instance().selectedAccount();
-    [self showPasswordPrompt];
-}
-#pragma mark - Export methods
-
-- (void)showPasswordPrompt
-{
-    auto account = AccountModel::instance().selectedAccount();
-    passwordWC = [[ExportPasswordWC alloc] initWithDelegate:self actionCode:1];
-    [passwordWC setAccount: account];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: passwordWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-}
-
-
-#pragma mark - NSOutlineViewDelegate methods
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
-{
-    return YES;
-}
-
-- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
-{
-    return [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
-}
-
-- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    NSTableView* result = [outlineView makeViewWithIdentifier:@"DeviceView" owner:self];
-
-    QModelIndex qIdx = [self.devicesTreeController toQIdx:((NSTreeNode*)item)];
-    if(!qIdx.isValid())
-        return result;
-
-    NSTextField* nameLabel = [result viewWithTag:TAG_NAME];
-    NSTextField* deviceIDLabel = [result viewWithTag:TAG_DEVICE_IDS];
-
-    auto account = AccountModel::instance().selectedAccount();
-
-    NSString* string = account->ringDeviceModel()->data(qIdx,Qt::DisplayRole).toString().toNSString();
-
-    [nameLabel setStringValue:account->alias().toNSString()];
-    [deviceIDLabel setStringValue:string];
-
-    return result;
-}
-
-@end
diff --git a/src/AccGeneralVC.mm b/src/AccGeneralVC.mm
deleted file mode 100644
index a209136..0000000
--- a/src/AccGeneralVC.mm
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-#import "AccGeneralVC.h"
-
-#import <accountmodel.h>
-#import <protocolmodel.h>
-#import <qitemselectionmodel.h>
-
-@interface AccGeneralVC () {
-
-    __unsafe_unretained IBOutlet NSTextField *aliasTextField;
-
-    __unsafe_unretained IBOutlet NSTextField *serverHostTextField;
-    __unsafe_unretained IBOutlet NSTextField *usernameTextField;
-    __unsafe_unretained IBOutlet NSSecureTextField *passwordTextField;
-    NSTextField *clearTextField;
-
-    __unsafe_unretained IBOutlet NSButton *upnpButton;
-    __unsafe_unretained IBOutlet NSButton *autoAnswerButton;
-    __unsafe_unretained IBOutlet NSButton *userAgentButton;
-    __unsafe_unretained IBOutlet NSTextField *userAgentTextField;
-}
-@end
-
-@implementation AccGeneralVC
-
-//Tags for views
-typedef NS_ENUM(NSInteger, TagViews) {
-    ALIAS       = 0,
-    HOSTNAME    = 1,
-    USERNAME    = 2,
-    PASSWORD    = 3,
-    USERAGENT   = 4,
-    DTMF_SIP    = 5,
-    DTMF_RTP    = 6,
-};
-
-- (void)awakeFromNib
-{
-    NSLog(@"INIT General VC");
-    [aliasTextField setTag:TagViews::ALIAS];
-    [serverHostTextField setTag:TagViews::HOSTNAME];
-    [usernameTextField setTag:TagViews::USERNAME];
-    [passwordTextField setTag:TagViews::PASSWORD];
-    [userAgentTextField setTag:TagViews::USERAGENT];
-
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-}
-
-- (IBAction)toggleUpnp:(NSButton *)sender {
-    AccountModel::instance().selectedAccount()->setUpnpEnabled([sender state] == NSOnState);
-}
-
-- (IBAction)toggleAutoAnswer:(NSButton *)sender {
-    AccountModel::instance().selectedAccount()->setAutoAnswer([sender state] == NSOnState);
-}
-
-- (IBAction)toggleCustomAgent:(NSButton *)sender {
-    [userAgentTextField setEnabled:[sender state] == NSOnState];
-    AccountModel::instance().selectedAccount()->setHasCustomUserAgent([sender state] == NSOnState);
-}
-
-- (void)loadAccount
-{
-    auto account = AccountModel::instance().selectedAccount();
-
-    [aliasTextField setStringValue:account->alias().toNSString()];
-    [serverHostTextField setStringValue:account->hostname().toNSString()];
-    [usernameTextField setStringValue:account->username().toNSString()];
-    [passwordTextField setStringValue:account->password().toNSString()];
-    [clearTextField setStringValue:account->password().toNSString()];
-
-    [upnpButton setState:AccountModel::instance().selectedAccount()->isUpnpEnabled()];
-    [userAgentButton setState:AccountModel::instance().selectedAccount()->hasCustomUserAgent()];
-    [userAgentTextField setEnabled:AccountModel::instance().selectedAccount()->hasCustomUserAgent()];
-    [autoAnswerButton setState:AccountModel::instance().selectedAccount()->isAutoAnswer()];
-    [userAgentTextField setStringValue:account->userAgent().toNSString()];
-}
-
-- (IBAction)tryRegistration:(id)sender {
-    AccountModel::instance().selectedAccount() << Account::EditAction::SAVE;
-}
-
-- (IBAction)showPassword:(NSButton *)sender {
-    if (sender.state == NSOnState) {
-        clearTextField = [[NSTextField alloc] initWithFrame:passwordTextField.frame];
-        [clearTextField setTag:passwordTextField.tag];
-        [clearTextField setDelegate:self];
-        [clearTextField setBounds:passwordTextField.bounds];
-        [clearTextField setStringValue:passwordTextField.stringValue];
-        [clearTextField becomeFirstResponder];
-        [self.view addSubview:clearTextField];
-        [passwordTextField setHidden:YES];
-    } else {
-        [passwordTextField setStringValue:clearTextField.stringValue];
-        [passwordTextField setHidden:NO];
-        [clearTextField removeFromSuperview];
-        clearTextField = nil;
-    }
-}
-
-/**
- *  Debug purpose
- */
--(void) dumpFrame:(CGRect) frame WithName:(NSString*) name
-{
-    NSLog(@"frame %@ : %f %f %f %f \n\n",name ,frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
-}
-
-#pragma mark - NSTextFieldDelegate methods
-
-- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
-{
-    return YES;
-}
-
--(void)controlTextDidChange:(NSNotification *)notif
-{
-    NSTextField *textField = [notif object];
-
-    switch ([textField tag]) {
-        case TagViews::ALIAS:
-            AccountModel::instance().selectedAccount()->setAlias([[textField stringValue] UTF8String]);
-            AccountModel::instance().selectedAccount()->setDisplayName([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::HOSTNAME:
-            AccountModel::instance().selectedAccount()->setHostname([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::USERNAME:
-            AccountModel::instance().selectedAccount()->setUsername([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::PASSWORD:
-            AccountModel::instance().selectedAccount()->setPassword([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::USERAGENT:
-            AccountModel::instance().selectedAccount()->setUserAgent([[textField stringValue] UTF8String]);
-            break;
-        default:
-            break;
-    }
-}
-
-@end
diff --git a/src/AccMediaVC.h b/src/AccMediaVC.h
deleted file mode 100644
index 9082adf..0000000
--- a/src/AccMediaVC.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import <account.h>
-
-#import "QNSTreeController.h"
-
-@interface AccMediaVC : NSViewController <NSOutlineViewDelegate>
-
-@end
\ No newline at end of file
diff --git a/src/AccMediaVC.mm b/src/AccMediaVC.mm
deleted file mode 100644
index c1c8529..0000000
--- a/src/AccMediaVC.mm
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-#import "AccMediaVC.h"
-
-///Qt
-#import <QSortFilterProxyModel>
-#import <qitemselectionmodel.h>
-
-///LRC
-#import <codecmodel.h>
-#import <accountmodel.h>
-#import <ringtonemodel.h>
-#import <ringtone.h>
-
-@interface AccMediaVC ()
-
-@property QNSTreeController* audioTreeController;
-@property QNSTreeController* videoTreeController;
-@property (unsafe_unretained) IBOutlet NSPopUpButton* ringtonePopUpButton;
-@property (unsafe_unretained) IBOutlet NSButton* enableRingtone;
-@property (unsafe_unretained) IBOutlet NSButton* playRingtone;
-@property (unsafe_unretained) IBOutlet NSButton *toggleVideoButton;
-@property (unsafe_unretained) IBOutlet NSOutlineView* audioCodecView;
-@property (unsafe_unretained) IBOutlet NSOutlineView* videoCodecView;
-@property (unsafe_unretained) IBOutlet NSView* videoPanelContainer;
-
-@end
-
-@implementation AccMediaVC
-@synthesize audioTreeController, videoTreeController;
-@synthesize audioCodecView, videoCodecView;
-@synthesize videoPanelContainer;
-@synthesize ringtonePopUpButton, enableRingtone, playRingtone, toggleVideoButton;
-
-NSInteger const TAG_CHECK       =   100;
-NSInteger const TAG_NAME        =   200;
-NSInteger const TAG_DETAILS     =   300;
-
-NSString*  const ID_AUDIO       =   @"audioview";
-NSString*  const ID_VIDEO       =   @"videoview";
-
-- (void) loadView
-{
-    [super loadView];
-    NSLog(@"INIT Media VC");
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-
-    QObject::connect(&RingtoneModel::instance(),
-                     &QAbstractItemModel::dataChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-
-                         NSString* label;
-                         if (!RingtoneModel::instance().isPlaying()) {
-                             label = NSLocalizedString(@"Play", @"Button label");
-                         } else {
-                             label = NSLocalizedString(@"Pause", @"Button label");
-                         }
-                         [playRingtone setTitle:label];
-                     });
-}
-
-- (void)loadAccount
-{
-    // AUDIO
-    [self loadAudioPrefs];
-
-    // VIDEO
-    [self loadVideoPrefs];
-
-}
-
-#pragma Audio Preferences method
-
-- (void) loadAudioPrefs
-{
-    auto account = AccountModel::instance().selectedAccount();
-    audioTreeController = [[QNSTreeController alloc] initWithQModel:account->codecModel()->audioCodecs()];
-    [audioTreeController setAvoidsEmptySelection:NO];
-    [audioTreeController setChildrenKeyPath:@"children"];
-    [audioCodecView bind:@"content" toObject:audioTreeController withKeyPath:@"arrangedObjects" options:nil];
-    [audioCodecView bind:@"sortDescriptors" toObject:audioTreeController withKeyPath:@"sortDescriptors" options:nil];
-    [audioCodecView bind:@"selectionIndexPaths" toObject:audioTreeController withKeyPath:@"selectionIndexPaths" options:nil];
-    [audioCodecView setIdentifier:ID_AUDIO];
-
-    QModelIndex qIdx = RingtoneModel::instance().selectionModel(account)->currentIndex();
-    [ringtonePopUpButton removeAllItems];
-    [ringtonePopUpButton addItemWithTitle:RingtoneModel::instance().data(qIdx, Qt::DisplayRole).toString().toNSString()];
-
-    [enableRingtone setState:account->isRingtoneEnabled()];
-    [ringtonePopUpButton setEnabled:account->isRingtoneEnabled()];
-}
-
-- (IBAction)startStopRingtone:(id)sender {
-    auto qIdx = RingtoneModel::instance().selectionModel(AccountModel::instance().selectedAccount())->currentIndex();
-    RingtoneModel::instance().play(qIdx);
-}
-
-- (IBAction)toggleRingtoneEnabled:(id)sender {
-    AccountModel::instance().selectedAccount()->setRingtoneEnabled([sender state]);
-    [ringtonePopUpButton setEnabled:[sender state]];
-}
-
-- (IBAction)chooseRingtone:(id)sender {
-    int index = [sender indexOfSelectedItem];
-    QModelIndex qIdx = RingtoneModel::instance().index(index, 0);
-    RingtoneModel::instance().selectionModel(AccountModel::instance().selectedAccount())->setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
-}
-
-- (IBAction)moveAudioCodecUp:(id)sender {
-    if([[audioTreeController selectedNodes] count] > 0) {
-        QModelIndex qIdx = [audioTreeController toQIdx:[audioTreeController selectedNodes][0]];
-        if(!qIdx.isValid())
-            return;
-
-        QMimeData* mime = AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->mimeData(QModelIndexList() << qIdx);
-        AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->dropMimeData(mime, Qt::MoveAction, qIdx.row() - 1, 0, QModelIndex());
-    }
-}
-
-- (IBAction)moveAudioCodecDown:(id)sender {
-    if([[audioTreeController selectedNodes] count] > 0) {
-        QModelIndex qIdx = [audioTreeController toQIdx:[audioTreeController selectedNodes][0]];
-        if(!qIdx.isValid())
-            return;
-
-        QMimeData* mime = AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->mimeData(QModelIndexList() << qIdx);
-        AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->dropMimeData(mime, Qt::MoveAction, qIdx.row() + 1, 0, QModelIndex());
-    }
-}
-
-- (IBAction)toggleAudioCodec:(NSButton*)sender {
-    NSInteger row = [audioCodecView rowForView:sender];
-    QModelIndex qIdx = AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->index(row, 0, QModelIndex());
-    AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->setData(qIdx, sender.state == NSOnState ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
-}
-
-#pragma Video Preferences method
-
--(void) loadVideoPrefs
-{
-    auto account = AccountModel::instance().selectedAccount();
-    videoTreeController = [[QNSTreeController alloc] initWithQModel:account->codecModel()->videoCodecs()];
-    [videoTreeController setAvoidsEmptySelection:NO];
-    [videoTreeController setChildrenKeyPath:@"children"];
-
-    [videoCodecView setIdentifier:ID_VIDEO];
-    [videoCodecView bind:@"content" toObject:videoTreeController withKeyPath:@"arrangedObjects" options:nil];
-    [videoCodecView bind:@"sortDescriptors" toObject:videoTreeController withKeyPath:@"sortDescriptors" options:nil];
-    [videoCodecView bind:@"selectionIndexPaths" toObject:videoTreeController withKeyPath:@"selectionIndexPaths" options:nil];
-    [videoPanelContainer setHidden:!account->isVideoEnabled()];
-    [toggleVideoButton setState:account->isVideoEnabled()?NSOnState:NSOffState];
-
-}
-
-- (IBAction)toggleVideoEnabled:(id)sender {
-    AccountModel::instance().selectedAccount()->setVideoEnabled([sender state] == NSOnState);
-    [videoPanelContainer setHidden:!AccountModel::instance().selectedAccount()->isVideoEnabled()];
-}
-
-- (IBAction)toggleVideoCodec:(NSButton*)sender {
-    NSInteger row = [videoCodecView rowForView:sender];
-    QModelIndex qIdx = AccountModel::instance().selectedAccount()->codecModel()->videoCodecs()->index(row, 0, QModelIndex());
-    AccountModel::instance().selectedAccount()->codecModel()->videoCodecs()->setData(qIdx, sender.state == NSOnState ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
-}
-
-- (IBAction)moveVideoCodecUp:(id)sender {
-
-    if([[videoTreeController selectedNodes] count] > 0) {
-        QModelIndex qIdx = [videoTreeController toQIdx:[videoTreeController selectedNodes][0]];
-        if(!qIdx.isValid())
-            return;
-
-        QMimeData* mime = AccountModel::instance().selectedAccount()->codecModel()->mimeData(QModelIndexList() << qIdx);
-        AccountModel::instance().selectedAccount()->codecModel()->dropMimeData(mime, Qt::MoveAction, qIdx.row() - 1, 0, QModelIndex());
-    }
-}
-
-- (IBAction)moveVideoCodecDown:(id)sender {
-    if([[videoTreeController selectedNodes] count] > 0) {
-        QModelIndex qIdx = [videoTreeController toQIdx:[videoTreeController selectedNodes][0]];
-        if(!qIdx.isValid())
-            return;
-
-        QMimeData* mime = AccountModel::instance().selectedAccount()->codecModel()->mimeData(QModelIndexList() << qIdx);
-        AccountModel::instance().selectedAccount()->codecModel()->dropMimeData(mime, Qt::MoveAction, qIdx.row() + 1, 0, QModelIndex());
-    }
-}
-
-
-#pragma mark - NSOutlineViewDelegate methods
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
-{
-    return YES;
-}
-
-- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    NSTableView* result = [outlineView makeViewWithIdentifier:@"CodecView" owner:self];
-
-    QModelIndex qIdx;
-    if ([outlineView.identifier isEqualToString:ID_AUDIO])
-        qIdx = [audioTreeController toQIdx:((NSTreeNode*)item)];
-    else
-        qIdx = [videoTreeController toQIdx:((NSTreeNode*)item)];
-
-    if(!qIdx.isValid())
-        return result;
-    NSTextField* name = [result viewWithTag:TAG_NAME];
-    NSTextField* details = [result viewWithTag:TAG_DETAILS];
-    NSButton* check = [result viewWithTag:TAG_CHECK];
-
-    if ([outlineView.identifier isEqualToString:ID_AUDIO]) {
-        [name setStringValue:AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->data(qIdx, CodecModel::Role::NAME).toString().toNSString()];
-        [details setStringValue:[NSString stringWithFormat:@"%@ Hz", AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->data(qIdx, CodecModel::Role::SAMPLERATE).toString().toNSString()]];
-        [check setState:AccountModel::instance().selectedAccount()->codecModel()->audioCodecs()->data(qIdx, Qt::CheckStateRole).value<BOOL>()?NSOnState:NSOffState];
-    } else {
-        [name setStringValue:AccountModel::instance().selectedAccount()->codecModel()->videoCodecs()->data(qIdx, CodecModel::Role::NAME).toString().toNSString()];
-        [check setState:AccountModel::instance().selectedAccount()->codecModel()->videoCodecs()->data(qIdx, Qt::CheckStateRole).value<BOOL>()?NSOnState:NSOffState];
-    }
-
-    return result;
-}
-
-#pragma mark - NSMenuDelegate methods
-
-- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
-{
-    QModelIndex qIdx;
-    qIdx = RingtoneModel::instance().index(index, 0);
-    [item setTitle:RingtoneModel::instance().data(qIdx, Qt::DisplayRole).toString().toNSString()];
-
-    if (qIdx == RingtoneModel::instance().selectionModel(AccountModel::instance().selectedAccount())->currentIndex()) {
-        [ringtonePopUpButton selectItem:item];
-    }
-    return YES;
-}
-
-- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
-{
-    return RingtoneModel::instance().rowCount();
-}
-
-@end
diff --git a/src/AccountsVC.h b/src/AccRingGeneralVC.h
similarity index 61%
rename from src/AccountsVC.h
rename to src/AccRingGeneralVC.h
index 7303aab..974d1ab 100644
--- a/src/AccountsVC.h
+++ b/src/AccRingGeneralVC.h
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,7 +20,15 @@
 
 #import <Cocoa/Cocoa.h>
 #import "LrcModelsProtocol.h"
+#import "BackupAccountWC.h"
+#import "RegisterNameWC.h"
+#import "AccountSettingsVC.h"
+#import "PasswordChangeWC.h"
 
-@interface AccountsVC : NSViewController <NSOutlineViewDelegate, NSMenuDelegate, LrcModelsProtocol>
+@interface AccRingGeneralVC : NSViewController <NSTextFieldDelegate, LrcModelsProtocol, BackupAccountDelegate, RegisterNameDelegate, AccountGeneralProtocol, NSTableViewDelegate, NSTableViewDataSource, PasswordChangeDelegate>
+
+- (void) setSelectedAccount:(std::string) account;
+
+@property (assign)BOOL accountEnabled;
 
 @end
diff --git a/src/AccRingGeneralVC.mm b/src/AccRingGeneralVC.mm
new file mode 100644
index 0000000..fb5bdc2
--- /dev/null
+++ b/src/AccRingGeneralVC.mm
@@ -0,0 +1,546 @@
+/*
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+#import "AccRingGeneralVC.h"
+
+//cocoa
+#import <Quartz/Quartz.h>
+
+
+//Qt
+#import <QSize>
+#import <QtMacExtras/qmacfunctions.h>
+#import <QPixmap>
+
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <api/newdevicemodel.h>
+#import <interfaces/pixmapmanipulatori.h>
+#import <globalinstances.h>
+
+#import "RegisterNameWC.h"
+#import "RestoreAccountWC.h"
+#import "BackupAccountWC.h"
+#import "views/NSColor+RingTheme.h"
+#import "views/NSImage+Extensions.h"
+#import "views/HoverTableRowView.h"
+#import "ExportPasswordWC.h"
+#import "utils.h"
+
+@interface AccRingGeneralVC ()
+
+@property (unsafe_unretained) IBOutlet NSTextField *displayNameField;
+@property (unsafe_unretained) IBOutlet NSTextField *ringIDField;
+@property (unsafe_unretained) IBOutlet NSTextField *registeredNameField;
+@property (unsafe_unretained) IBOutlet NSButton *registerNameButton;
+@property (unsafe_unretained) IBOutlet NSButton* photoView;
+@property (unsafe_unretained) IBOutlet NSButton* passwordButton;
+@property (unsafe_unretained) IBOutlet NSButton* removeAccountButton;
+@property (unsafe_unretained) IBOutlet NSImageView* addProfilePhotoImage;
+@property (unsafe_unretained) IBOutlet NSTableView* devicesTableView;
+@property (unsafe_unretained) IBOutlet NSTableView* blockedContactsTableView;
+@property (assign) IBOutlet NSLayoutConstraint* buttonRegisterWidthConstraint;
+@property (assign) IBOutlet NSLayoutConstraint* bannedContactHeightConstraint;
+@property (assign) IBOutlet NSLayoutConstraint* advancedButtonMarginConstraint;
+
+
+@property AbstractLoadingWC* accountModal;
+@property PasswordChangeWC* passwordModal;
+@property std::string selectedAccountID;
+
+@end
+
+@implementation AccRingGeneralVC
+
+QMetaObject::Connection deviceAddedSignal;
+QMetaObject::Connection deviceRevokedSignal;
+QMetaObject::Connection deviceUpdatedSignal;
+QMetaObject::Connection contactBlockedSignal;
+QMetaObject::Connection bannedContactsChangedSignal;
+
+
+@synthesize displayNameField;
+@synthesize ringIDField;
+@synthesize registeredNameField;
+@synthesize photoView;
+@synthesize addProfilePhotoImage;
+@synthesize accountModel;
+@synthesize registerNameButton, passwordButton, removeAccountButton;
+@synthesize buttonRegisterWidthConstraint;
+@synthesize accountModal;
+@synthesize delegate;
+@synthesize devicesTableView;
+@synthesize blockedContactsTableView;
+
+
+typedef NS_ENUM(NSInteger, TagViews) {
+    DISPLAYNAME = 100,
+    DEVICE_NAME_TAG = 200,
+    DEVICE_ID_TAG = 300,
+    DEVICE_EDIT_TAG = 400,
+    DEVICE_REVOKE_TAG = 500,
+    BANNED_CONTACT_NAME_TAG = 600,
+    BANNED_CONTACT_ID_TAG = 700,
+    UNBLOCK_CONTACT_TAG = 800
+};
+
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
+{
+    if (self =  [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
+}
+
+- (void)awakeFromNib
+{
+    [super awakeFromNib];
+    [photoView setBordered:YES];
+    [addProfilePhotoImage setWantsLayer: YES];
+    devicesTableView.delegate = self;
+    devicesTableView.dataSource = self;
+    blockedContactsTableView.delegate = self;
+    blockedContactsTableView.dataSource= self;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [self updateView];
+}
+
+- (void) setSelectedAccount:(std::string) account {
+    self.selectedAccountID = account;
+    [self connectSignals];
+    [self updateView];
+    [self hideBannedContacts];
+}
+
+-(void) updateView {
+    const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
+    QByteArray ba = QByteArray::fromStdString(account.profileInfo.avatar);
+
+    QVariant photo = GlobalInstances::pixmapManipulator().personPhoto(ba, nil);
+    if(QtMac::toNSImage(qvariant_cast<QPixmap>(photo))) {
+        [photoView setBordered:NO];
+        NSImage *image = QtMac::toNSImage(qvariant_cast<QPixmap>(photo));
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        image = [image cropImageToSize:CGSizeMake(newSize, newSize)];
+        [photoView setImage: [image roundCorners: image.size.height * 0.5]];
+        [addProfilePhotoImage setHidden:YES];
+    } else {
+        [photoView setImage:nil];
+        [photoView setBordered:YES];
+        [addProfilePhotoImage setHidden:NO];
+    }
+    NSString* displayName = @(account.profileInfo.alias.c_str());
+    [displayNameField setStringValue:displayName];
+    [ringIDField setStringValue:@(account.profileInfo.uri.c_str())];
+    if(account.registeredName.empty()) {
+        [registerNameButton setHidden:NO];
+        buttonRegisterWidthConstraint.constant = 260.0;
+    } else {
+        buttonRegisterWidthConstraint.constant = 0.0;
+        [registerNameButton setHidden:YES];
+    }
+
+    [registeredNameField setStringValue:@(account.registeredName.c_str())];
+
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    [passwordButton setTitle:accountProperties.archiveHasPassword ? @"Change password" : @"Create password"];
+    self.accountEnabled = account.enabled;
+
+    NSMutableAttributedString *colorTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[removeAccountButton attributedTitle]];
+    NSRange titleRange = NSMakeRange(0, [colorTitle length]);
+    [colorTitle addAttribute:NSForegroundColorAttributeName value:[NSColor errorColor] range:titleRange];
+    [removeAccountButton setAttributedTitle:colorTitle];
+    [devicesTableView reloadData];
+    [blockedContactsTableView reloadData];
+}
+
+-(void) connectSignals {
+    QObject::disconnect(deviceAddedSignal);
+    QObject::disconnect(deviceRevokedSignal);
+    QObject::disconnect(deviceUpdatedSignal);
+    QObject::disconnect(bannedContactsChangedSignal);
+    deviceAddedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
+                                         &lrc::api::NewDeviceModel::deviceAdded,
+                                         [self] (const std::string &id) {
+                                             [devicesTableView reloadData];
+                                         });
+    deviceRevokedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
+                                           &lrc::api::NewDeviceModel::deviceRevoked,
+                                           [self] (const std::string &id, const lrc::api::NewDeviceModel::Status status) {
+                                               switch (status) {
+                                                   case lrc::api::NewDeviceModel::Status::SUCCESS:
+                                                       [devicesTableView reloadData];
+                                                       break;
+                                                   case lrc::api::NewDeviceModel::Status::WRONG_PASSWORD:
+                                                       [self showAlertWithTitle: @"" andText: @"Device revocation failed with error: Wrong password"];
+                                                       break;
+                                                   case lrc::api::NewDeviceModel::Status::UNKNOWN_DEVICE:
+                                                       [self showAlertWithTitle: @"" andText: @"Device revocation failed with error: Unknown device"];
+                                                       break;
+                                               }
+                                           });
+    deviceUpdatedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
+                                           &lrc::api::NewDeviceModel::deviceUpdated,
+                                           [self] (const std::string &id) {
+                                               [devicesTableView reloadData];
+                                           });
+    bannedContactsChangedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).contactModel,
+                                                   &lrc::api::ContactModel::bannedStatusChanged,
+                                                   [self] (const std::string &contactUri, bool banned) {
+                                                       [blockedContactsTableView reloadData];
+                                                   });
+}
+
+-(void) showAlertWithTitle: (NSString *) title andText: (NSString *)text {
+    NSAlert *alert = [[NSAlert alloc] init];
+    [alert addButtonWithTitle:@"OK"];
+    [alert setMessageText:title];
+    [alert setInformativeText:text];
+    [alert runModal];
+}
+
+- (void)pictureTakerDidEnd:(IKPictureTaker *) picker
+                returnCode:(NSInteger) code
+               contextInfo:(void*) contextInfo
+{
+    if (auto outputImage = [picker outputImage]) {
+        auto image = [picker inputImage];
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
+        [photoView setImage: [outputImage roundCorners: outputImage.size.height * 0.5]];
+        [photoView setBordered:NO];
+        [addProfilePhotoImage setHidden:YES];
+        auto imageToBytes = QByteArray::fromNSData([outputImage TIFFRepresentation]).toBase64();
+        std::string imageToString = std::string(imageToBytes.constData(), imageToBytes.length());
+        self.accountModel->setAvatar(self.selectedAccountID, imageToString);
+    } else if(!photoView.image) {
+        [photoView setBordered:YES];
+        [addProfilePhotoImage setHidden:NO];
+    }
+}
+
+#pragma mark - RegisterNameDelegate methods
+
+- (void) didRegisterName:(NSString *) name withSuccess:(BOOL) success
+{
+    [self.accountModal close];
+    if(!success) {
+        return;
+    }
+
+    if(name.length == 0) {
+        return;
+    }
+    buttonRegisterWidthConstraint.constant = 0.0;
+    [registerNameButton setHidden:YES];
+    [registeredNameField setStringValue:name];
+}
+
+#pragma mark - NSTextFieldDelegate delegate methods
+
+- (void)controlTextDidChange:(NSNotification *)notif
+{
+    NSTextField* textField = [notif object];
+    if (textField.tag != DISPLAYNAME) {
+        return;
+    }
+    NSString* displayName = textField.stringValue;
+
+    [NSObject cancelPreviousPerformRequestsWithTarget:self];
+    self.accountModel->setAlias(self.selectedAccountID, [displayName UTF8String]);
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+}
+
+#pragma mark - NSTableViewDataSource methods
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+    if(tableView == devicesTableView) {
+        return self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices().size();
+    } else if (tableView == blockedContactsTableView){
+        return self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts().size();
+    }
+    return 0;
+}
+
+#pragma mark - NSTableViewDelegate methods
+- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+    if(tableView == devicesTableView) {
+        NSTableCellView* deviceView = [tableView makeViewWithIdentifier:@"TableCellDeviceItem" owner:self];
+        NSTextField* nameLabel = [deviceView viewWithTag: DEVICE_NAME_TAG];
+        NSTextField* idLabel = [deviceView viewWithTag: DEVICE_ID_TAG];
+        NSButton* revokeButton = [deviceView viewWithTag: DEVICE_REVOKE_TAG];
+        NSButton* editButton = [deviceView viewWithTag: DEVICE_EDIT_TAG];
+        [editButton setAction:@selector(editDevice:)];
+        [editButton setTarget:self];
+        [revokeButton setAction:@selector(startDeviceRevocation:)];
+        [revokeButton setTarget:self];
+        auto devices = self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices();
+        auto device = devices.begin();
+
+        std::advance(device, row);
+
+        auto name = device->name;
+        auto deviceID = device->id;
+
+        [nameLabel setStringValue: @(name.c_str())];
+        [idLabel setStringValue: @(deviceID.c_str())];
+        [revokeButton setHidden: device->isCurrent];
+        [editButton setHidden: !device->isCurrent];
+        return deviceView;
+    } else if (tableView == blockedContactsTableView) {
+        NSTableCellView* contactView = [tableView makeViewWithIdentifier:@"TableCellBannedContactItem" owner:self];
+        NSTextField* nameLabel = [contactView viewWithTag: BANNED_CONTACT_NAME_TAG];
+        NSTextField* idLabel = [contactView viewWithTag: BANNED_CONTACT_ID_TAG];
+        NSButton* revokeButton = [contactView viewWithTag: UNBLOCK_CONTACT_TAG];
+        auto contacts = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts();
+        auto contactID = contacts.begin();
+        std::advance(contactID, row);
+        [idLabel setStringValue: @(contactID->c_str())];
+        auto contact = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getContact([@(contactID->c_str()) UTF8String]);
+        [nameLabel setStringValue: bestNameForContact(contact)];
+        [revokeButton setAction:@selector(unblockContact:)];
+        [revokeButton setTarget:self];
+        return contactView;
+    }
+}
+
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
+{
+    if(tableView == devicesTableView) {
+        return tableView.rowHeight;
+    } else if (tableView == blockedContactsTableView) {
+        CGFloat height = self.bannedContactHeightConstraint.constant;
+        if(height == 150) {
+            return 52;
+        } else {
+            return 1;
+        }
+    }
+}
+
+- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
+{
+    return [tableView makeViewWithIdentifier:@"HoverRowView" owner:nil];
+}
+
+#pragma mark - Actions
+
+- (IBAction)editPhoto:(id)sender
+{
+    auto pictureTaker = [IKPictureTaker pictureTaker];
+
+    [pictureTaker beginPictureTakerSheetForWindow:[self.view window]
+                                     withDelegate:self
+                                   didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
+                                      contextInfo:nil];
+
+}
+
+- (IBAction)startExportOnRing:(id)sender
+{
+    ExportPasswordWC *passwordWC = [[ExportPasswordWC alloc] initWithNibName:@"ExportPasswordWindow" bundle: nil accountmodel: self.accountModel];
+    passwordWC.selectedAccountID = self.selectedAccountID;
+    accountModal = passwordWC;
+    [self.view.window beginSheet: passwordWC.window completionHandler:nil];
+}
+- (IBAction)triggerAdwancedSettings: (NSButton *)sender {
+    [self.delegate triggerAdvancedOptions];
+}
+
+- (IBAction)enableAccount: (NSButton *)sender {
+    const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
+    self.accountModel->enableAccount(self.selectedAccountID, !account.enabled);
+    self.accountEnabled = account.enabled;
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+}
+
+- (IBAction)removeAccount:(id)sender
+{
+    NSAlert *alert = [[NSAlert alloc] init];
+    [alert addButtonWithTitle:@"OK"];
+    [alert addButtonWithTitle:@"Cancel"];
+    [alert setMessageText: NSLocalizedString(@"Remove account",
+                                             @"Remove account alert title")];
+    [alert setInformativeText:NSLocalizedString(@"By clicking \"OK\" you will remove this account on this device! This action can not be undone. Also, your registered name can be lost.",
+                                                @"Remove account alert message")];
+
+    if ([alert runModal] == NSAlertFirstButtonReturn) {
+        self.accountModel->removeAccount(self.selectedAccountID);
+    }
+}
+
+- (IBAction)exportAccount:(id)sender
+{
+    BackupAccountWC* passwordWC = [[BackupAccountWC alloc] initWithNibName:@"BackupAccountWindow" bundle: nil accountmodel: self.accountModel];
+    passwordWC.delegate = self;
+    [passwordWC setAllowFileSelection:NO];
+    accountModal = passwordWC;
+    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
+}
+
+- (IBAction)startNameRegistration:(id)sender
+{
+    RegisterNameWC* registerWC = [[RegisterNameWC alloc] initWithNibName:@"RegisterNameWindow" bundle: nil accountmodel: self.accountModel];
+    registerWC.delegate = self;
+    registerWC.selectedAccountID = self.selectedAccountID;
+    self.accountModal = registerWC;
+    [self.view.window beginSheet:registerWC.window completionHandler:nil];
+}
+- (IBAction)changePassword:(id)sender
+{
+    PasswordChangeWC* passwordWC = [[PasswordChangeWC alloc] initWithNibName:@"PasswordChange" bundle: nil accountmodel: self.accountModel];
+    passwordWC.selectedAccountID = self.selectedAccountID;
+    passwordWC.delegate = self;
+    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
+    self.passwordModal = passwordWC;
+}
+
+- (IBAction)showBanned: (NSButton *)sender {
+    CGFloat height = self.bannedContactHeightConstraint.constant;
+    NSRect frame = self.view.frame;
+    if(height == 150) {
+        frame.size.height =  frame.size.height - 150 - 10;
+    } else {
+        frame.size.height =  frame.size.height + 150 + 10;
+    }
+    self.view.frame = frame;
+    [self.delegate updateFrame];
+    CGFloat advancedHeight = self.advancedButtonMarginConstraint.constant;
+    self.advancedButtonMarginConstraint.constant = (height== 2) ? 40 : 30;
+    self.bannedContactHeightConstraint.constant = (height== 2) ? 150 : 2;
+    [[[self.blockedContactsTableView superview] superview] setHidden:![[[self.blockedContactsTableView superview] superview] isHidden]];
+    [blockedContactsTableView reloadData];
+}
+
+-(void) hideBannedContacts {
+    CGFloat height = self.bannedContactHeightConstraint.constant;
+    NSRect frame = self.view.frame;
+    if(height == 150) {
+        [self showBanned:nil];
+    }
+}
+
+- (IBAction)startDeviceRevocation:(NSView*)sender
+{
+    NSInteger row = [devicesTableView rowForView:sender];
+    if(row < 0) {
+        return;
+    }
+    auto devices = self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices();
+    auto device = devices.begin();
+    std::advance(device, row);
+    if(device == devices.end()) {
+        return;
+    }
+    [self proceedDeviceRevokationAlert:device->id];
+}
+
+- (IBAction)unblockContact:(NSView*)sender
+{
+    NSInteger row = [blockedContactsTableView rowForView:sender];
+    if(row < 0) {
+        return;
+    }
+    auto contacts = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts();
+    auto contactID = contacts.begin();
+    std::advance(contactID, row);
+    if(contactID == contacts.end()) {
+        return;
+    }
+    auto contact = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getContact([@(contactID->c_str()) UTF8String]);
+    if(!contact.isBanned) {
+        return;
+    }
+    self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->addContact(contact);
+}
+
+- (IBAction)editDevice:(NSView*)sender
+{
+    NSInteger row = [devicesTableView rowForView:sender];
+    if(row < 0) {
+        return;
+    }
+
+    NSTableCellView* deviceView = [devicesTableView viewAtColumn:0 row:row makeIfNecessary:NO];
+    if(!deviceView || ![deviceView isKindOfClass:[NSTableCellView class]]) {
+        return;
+    }
+
+    NSTextField* nameLabel = [deviceView viewWithTag: DEVICE_NAME_TAG];
+    NSButton* editButton = [deviceView viewWithTag: DEVICE_EDIT_TAG];
+    if ([nameLabel isEditable]) {
+        self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->setCurrentDeviceName([nameLabel.stringValue UTF8String]);
+        [nameLabel setEditable:NO];
+        [self.view.window makeFirstResponder:nil];
+        editButton.image = [NSImage imageNamed:NSImageNameTouchBarComposeTemplate];
+        return;
+    }
+    [nameLabel setEditable:YES];
+    [nameLabel becomeFirstResponder];
+    editButton.image = [NSImage imageNamed:NSImageNameTouchBarDownloadTemplate];
+}
+
+-(void) revokeDeviceWithID: (std::string) deviceID password:(NSString *) password {
+    self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->revokeDevice(deviceID, [password UTF8String]);
+}
+
+-(void) proceedDeviceRevokationAlert: (std::string) deviceID {
+    NSAlert *alert = [[NSAlert alloc] init];
+    [alert addButtonWithTitle:@"OK"];
+    [alert addButtonWithTitle:@"Cancel"];
+    [alert setMessageText:@"Revoke Device"];
+    [alert setInformativeText:@"Attention! This action could not be undone!"];
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    if(accountProperties.archiveHasPassword) {
+        NSSecureTextField *passwordText = [[NSSecureTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
+        [passwordText setPlaceholderString:@"Enter password"];
+        [alert setAccessoryView:passwordText];
+        if ([alert runModal] == NSAlertFirstButtonReturn) {
+            [self revokeDeviceWithID:deviceID password:[passwordText stringValue]];
+        }
+    } else {
+        if ([alert runModal] == NSAlertFirstButtonReturn) {
+            [self revokeDeviceWithID:deviceID password:@""];
+        }
+    }
+}
+
+#pragma mark - BackupAccountDelegate methods
+
+-(void) didCompleteExportWithPath:(NSURL*) fileUrl
+{
+    [[NSWorkspace sharedWorkspace] selectFile:fileUrl.path inFileViewerRootedAtPath:@""];
+}
+
+#pragma mark - PasswordChangeDelegate
+
+-(void) paswordCreatedWithSuccess:(BOOL) success
+{
+    [passwordButton setTitle: success ? @"Change password" : @"Create password"];
+}
+
+@end
diff --git a/src/AccRingVC.h b/src/AccRingVC.h
deleted file mode 100644
index f6b56b1..0000000
--- a/src/AccRingVC.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import <account.h>
-
-@interface AccRingVC : NSViewController <NSTextFieldDelegate>
-
-@end
\ No newline at end of file
diff --git a/src/AccRingVC.mm b/src/AccRingVC.mm
deleted file mode 100644
index 8083a68..0000000
--- a/src/AccRingVC.mm
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-#import "AccRingVC.h"
-
-#import <accountmodel.h>
-#import <qitemselectionmodel.h>
-
-#import "RegisterNameWC.h"
-#import "PasswordChangeWC.h"
-
-@interface AccRingVC () <RegisterNameDelegate>
-
-@property (unsafe_unretained) IBOutlet NSTextField *aliasTextField;
-@property (unsafe_unretained) IBOutlet NSTextField *bootstrapField;
-@property (unsafe_unretained) IBOutlet NSTextField *blockchainField;
-@property (unsafe_unretained) IBOutlet NSTextField *ringIDField;
-@property (unsafe_unretained) IBOutlet NSButton *registerBlockchainNameButton;
-@property (unsafe_unretained) IBOutlet NSTextField *registeredNameField;
-
-@property (unsafe_unretained) IBOutlet NSButton *upnpButton;
-@property (unsafe_unretained) IBOutlet NSButton *autoAnswerButton;
-@property (unsafe_unretained) IBOutlet NSButton *userAgentButton;
-@property (unsafe_unretained) IBOutlet NSTextField *userAgentTextField;
-@property (unsafe_unretained) IBOutlet NSButton *allowUnknown;
-@property (unsafe_unretained) IBOutlet NSButton *allowHistory;
-@property (unsafe_unretained) IBOutlet NSButton *allowContacts;
-
-@property AbstractLoadingWC* accountModal;
-@property PasswordChangeWC* passwordModal;
-
-@end
-
-@implementation AccRingVC
-@synthesize bootstrapField;
-@synthesize ringIDField;
-@synthesize aliasTextField;
-@synthesize blockchainField;
-@synthesize upnpButton;
-@synthesize autoAnswerButton;
-@synthesize userAgentButton;
-@synthesize userAgentTextField;
-@synthesize allowContacts, allowHistory, allowUnknown;
-
-typedef NS_ENUM(NSInteger, TagViews) {
-    ALIAS = 0,
-    HOSTNAME,
-    USERAGENT,
-    BLOCKCHAIN,
-};
-
-- (void)awakeFromNib
-{
-    NSLog(@"INIT Ring VC");
-    [aliasTextField setTag:TagViews::ALIAS];
-    [userAgentTextField setTag:TagViews::USERAGENT];
-    [bootstrapField setTag:TagViews::HOSTNAME];
-    [blockchainField setTag:TagViews::BLOCKCHAIN];
-
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-}
-
-- (void)loadAccount
-{
-    auto account = AccountModel::instance().selectedAccount();
-
-    [self.aliasTextField setStringValue:account->alias().toNSString()];
-
-    [allowUnknown setState:account->allowIncomingFromUnknown()];
-    [allowHistory setState:account->allowIncomingFromHistory()];
-    [allowContacts setState:account->allowIncomingFromContact()];
-
-    [allowHistory setEnabled:!account->allowIncomingFromUnknown()];
-    [allowContacts setEnabled:!account->allowIncomingFromUnknown()];
-
-    [upnpButton setState:account->isUpnpEnabled()];
-    [userAgentButton setState:account->hasCustomUserAgent()];
-    [userAgentTextField setEnabled:account->hasCustomUserAgent()];
-
-    [autoAnswerButton setState:account->isAutoAnswer()];
-    [userAgentTextField setStringValue:account->userAgent().toNSString()];
-
-    [bootstrapField setStringValue:account->hostname().toNSString()];
-    [blockchainField setStringValue:account->nameServiceURL().toNSString()];
-
-    if([account->username().toNSString() isEqualToString:@""]) {
-        [ringIDField setStringValue:NSLocalizedString(@"Reopen account to see your hash",
-                                                    @"Show advice to user")];
-    } else {
-        [ringIDField setStringValue:account->username().toNSString()];
-    }
-
-    [self refreshRegisteredName:account];
-}
-
-- (void) refreshRegisteredName:(Account*) account
-{
-    [self.registerBlockchainNameButton setHidden:!account->registeredName().isEmpty()];
-    [self.registeredNameField setStringValue:account->registeredName().toNSString()];
-}
-
-- (IBAction)startNameRegistration:(id)sender
-{
-    auto registerWC = [[RegisterNameWC alloc] initWithDelegate:self];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:registerWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: registerWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-    self.accountModal = registerWC;
-}
-
-- (IBAction)changePassword:(id)sender
-{
-    auto passwordWC = [[PasswordChangeWC alloc] initWithAccount:AccountModel::instance().selectedAccount()];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: passwordWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-    self.passwordModal = passwordWC;
-}
-
-- (IBAction)toggleUpnp:(NSButton *)sender {
-    AccountModel::instance().selectedAccount()->setUpnpEnabled([sender state] == NSOnState);
-}
-
-- (IBAction)toggleAutoAnswer:(NSButton *)sender {
-    AccountModel::instance().selectedAccount()->setAutoAnswer([sender state] == NSOnState);
-}
-
-- (IBAction)toggleCustomAgent:(NSButton *)sender {
-    [self.userAgentTextField setEnabled:[sender state] == NSOnState];
-    AccountModel::instance().selectedAccount()->setHasCustomUserAgent([sender state] == NSOnState);
-}
-
-- (IBAction)toggleAllowFromUnknown:(id)sender {
-    AccountModel::instance().selectedAccount()->setAllowIncomingFromUnknown([sender state] == NSOnState);
-    [allowHistory setEnabled:![sender state] == NSOnState];
-    [allowContacts setEnabled:![sender state] == NSOnState];
-}
-- (IBAction)toggleAllowFromHistory:(id)sender {
-    AccountModel::instance().selectedAccount()->setAllowIncomingFromHistory([sender state] == NSOnState);
-}
-- (IBAction)toggleAllowFromContacts:(id)sender {
-    AccountModel::instance().selectedAccount()->setAllowIncomingFromContact([sender state] == NSOnState);
-}
-
-#pragma mark - NSTextFieldDelegate methods
-
-- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
-{
-    return YES;
-}
-
--(void)controlTextDidChange:(NSNotification *)notif
-{
-    NSTextField *textField = [notif object];
-
-    switch ([textField tag]) {
-        case TagViews::ALIAS:
-            AccountModel::instance().selectedAccount()->setAlias([[textField stringValue] UTF8String]);
-            AccountModel::instance().selectedAccount()->setDisplayName([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::HOSTNAME:
-            AccountModel::instance().selectedAccount()->setHostname([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::USERAGENT:
-            AccountModel::instance().selectedAccount()->setUserAgent([[textField stringValue] UTF8String]);
-            break;
-        case TagViews::BLOCKCHAIN:
-            AccountModel::instance().selectedAccount()->setNameServiceURL([[textField stringValue] UTF8String]);
-            break;
-        default:
-            break;
-    }
-}
-
-- (void) didRegisterNameWithSuccess
-{
-    [self.accountModal close];
-    [self refreshRegisteredName:AccountModel::instance().selectedAccount()];
-}
-
-@end
diff --git a/src/AccSecurityVC.h b/src/AccSecurityVC.h
deleted file mode 100644
index b77b6ee..0000000
--- a/src/AccSecurityVC.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@interface AccSecurityVC : NSViewController<NSMenuDelegate, NSPathControlDelegate, NSOpenSavePanelDelegate>
-
-@end
diff --git a/src/AccSecurityVC.mm b/src/AccSecurityVC.mm
deleted file mode 100644
index 3d0a0c2..0000000
--- a/src/AccSecurityVC.mm
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-#import "AccSecurityVC.h"
-
-#import <QUrl>
-#import <certificate.h>
-#import <tlsmethodmodel.h>
-#import <qitemselectionmodel.h>
-#import <ciphermodel.h>
-#import <accountmodel.h>
-
-#import "QNSTreeController.h"
-#import "CertificateWC.h"
-
-#define COLUMNID_NAME   @"CipherNameColumn"
-#define COLUMNID_STATE  @"CipherStateColumn"
-
-@interface AccSecurityVC () {
-    __unsafe_unretained IBOutlet NSOutlineView *cipherListView;
-    __unsafe_unretained IBOutlet NSButton *useTLS;
-    __unsafe_unretained IBOutlet NSView *tlsContainer;
-    __unsafe_unretained IBOutlet NSLayoutConstraint* tlsContainerHeight;
-
-    __unsafe_unretained IBOutlet NSView *pvkContainer;
-    __unsafe_unretained IBOutlet NSImageView *pvkPasswordValidation;
-
-    __unsafe_unretained IBOutlet NSButton *showUserCertButton;
-    __unsafe_unretained IBOutlet NSButton *showCAButton;
-    __unsafe_unretained IBOutlet NSSecureTextField *pvkPasswordField;
-    __unsafe_unretained IBOutlet NSTextField *outgoingTlsServerName;
-    __unsafe_unretained IBOutlet NSTextField *tlsNegotiationTimeout;
-    __unsafe_unretained IBOutlet NSStepper *tlsNegotiationTimeoutStepper;
-    __unsafe_unretained IBOutlet NSPathControl *caListPathControl;
-    __unsafe_unretained IBOutlet NSPathControl *certificatePathControl;
-    __unsafe_unretained IBOutlet NSPathControl *pvkPathControl;
-    __unsafe_unretained IBOutlet NSPopUpButton *tlsMethodList;
-    __unsafe_unretained IBOutlet NSButton *srtpRTPFallback;
-    __unsafe_unretained IBOutlet NSButton *useSRTP;
-
-    __unsafe_unretained IBOutlet NSButton *verifyCertAsClientButton;
-    __unsafe_unretained IBOutlet NSButton *verifyCertAsServerButton;
-    __unsafe_unretained IBOutlet NSButton *requireCertButton;
-}
-
-@property QNSTreeController *treeController;
-@property CertificateWC* certificateWC;
-
-@end
-
-@implementation AccSecurityVC
-@synthesize treeController;
-@synthesize certificateWC;
-
-// Tags for views
-NS_ENUM(NSInteger, TagViews) {
-    PVK_PASSWORD            = 0,
-    OUTGOING_TLS_SRV_NAME   = 1,
-    TLS_NEGOTIATION         = 2
-};
-
-- (void)awakeFromNib
-{
-    NSLog(@"INIT Security VC");
-    [pvkPasswordField setTag:TagViews::PVK_PASSWORD];
-    [outgoingTlsServerName setTag:TagViews::OUTGOING_TLS_SRV_NAME];
-    [tlsNegotiationTimeoutStepper setTag:TagViews::TLS_NEGOTIATION];
-    [tlsNegotiationTimeout setTag:TagViews::TLS_NEGOTIATION];
-
-    QObject::connect(AccountModel::instance().selectionModel(),
-                     &QItemSelectionModel::currentChanged,
-                     [=](const QModelIndex &current, const QModelIndex &previous) {
-                         if(!current.isValid())
-                             return;
-                         [self loadAccount];
-                     });
-}
-
-- (Account*) currentAccount
-{
-    auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
-    return AccountModel::instance().getAccountByModelIndex(accIdx);
-}
-
-- (void)loadAccount
-{
-    auto account = [self currentAccount];
-
-    [self updateControlsWithTag:TagViews::PVK_PASSWORD];
-    [self updateControlsWithTag:OUTGOING_TLS_SRV_NAME];
-    [self updateControlsWithTag:TagViews::TLS_NEGOTIATION];
-
-    QModelIndex qTlsMethodIdx = account->tlsMethodModel()->selectionModel()->currentIndex();
-    [tlsMethodList removeAllItems];
-    [tlsMethodList addItemWithTitle:qTlsMethodIdx.data(Qt::DisplayRole).toString().toNSString()];
-
-    treeController = [[QNSTreeController alloc] initWithQModel:account->cipherModel()];
-    [treeController setAvoidsEmptySelection:NO];
-    [treeController setAlwaysUsesMultipleValuesMarker:YES];
-    [treeController setChildrenKeyPath:@"children"];
-
-    [cipherListView bind:@"content" toObject:treeController withKeyPath:@"arrangedObjects" options:nil];
-    [cipherListView bind:@"sortDescriptors" toObject:treeController withKeyPath:@"sortDescriptors" options:nil];
-    [cipherListView bind:@"selectionIndexPaths" toObject:treeController withKeyPath:@"selectionIndexPaths" options:nil];
-
-    [useTLS setState:account->isTlsEnabled()];
-    [tlsContainer setHidden:!account->isTlsEnabled()];
-    tlsContainerHeight.constant = (account->isTlsEnabled()) ? 196.0f : 0.0f;
-
-    [useSRTP setState:account->isSrtpEnabled()];
-    [srtpRTPFallback setState:account->isSrtpRtpFallback()];
-    [srtpRTPFallback setEnabled:useSRTP.state];
-
-    if(account->tlsCaListCertificate() != nil) {
-        [caListPathControl setURL:[NSURL fileURLWithPath:account->tlsCaListCertificate()->path().toNSString()]];
-    } else {
-        [caListPathControl setURL:nil];
-    }
-
-    auto tlsCert = account->tlsCertificate();
-
-    if(tlsCert != nil) {
-        [certificatePathControl setURL:[NSURL fileURLWithPath:tlsCert->path().toNSString()]];
-        if(tlsCert->requirePrivateKey()) {
-            [pvkContainer setHidden:NO];
-            if(!account->tlsPrivateKey().isEmpty()) {
-                [pvkPathControl setURL:[NSURL fileURLWithPath:account->tlsPrivateKey().toNSString()]];
-                if (tlsCert->requirePrivateKeyPassword()) {
-                    [pvkPasswordField setHidden:NO];
-                } else
-                    [pvkPasswordField setHidden:YES];
-            } else {
-                [pvkPathControl setURL:nil];
-            }
-        } else {
-            [pvkContainer setHidden:YES];
-        }
-    } else {
-        [certificatePathControl setURL:nil];
-    }
-
-    if (account->tlsCaListCertificate())
-        [showCAButton setHidden:!(account->tlsCaListCertificate()->isValid() == Certificate::CheckValues::PASSED)];
-    else
-        [showCAButton setHidden:YES];
-
-    [verifyCertAsServerButton setState:account->isTlsVerifyServer()];
-    [verifyCertAsClientButton setState:account->isTlsVerifyClient()];
-    [requireCertButton setState:account->isTlsRequireClientCertificate()];
-}
-
-- (IBAction)chooseTlsMethod:(id)sender {
-    int index = [sender indexOfSelectedItem];
-    QModelIndex qIdx = [self currentAccount]->tlsMethodModel()->index(index, 0);
-    [self currentAccount]->tlsMethodModel()->selectionModel()->setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
-}
-
-- (IBAction)toggleUseTLS:(id)sender {
-    [self currentAccount]->setTlsEnabled([sender state]);
-    [tlsContainer setHidden:![sender state]];
-    tlsContainerHeight.constant = ([sender state]) ? 196.0f : 0.0f;
-}
-
-- (IBAction)toggleUseSRTP:(id)sender {
-    [self currentAccount]->setSrtpEnabled([sender state]);
-    [srtpRTPFallback setEnabled:[sender state]];
-}
-- (IBAction)toggleRTPFallback:(id)sender {
-    [self currentAccount]->setSrtpRtpFallback([sender state]);
-}
-
-- (IBAction)toggleVerifyCertAsClient:(id)sender {
-    [self currentAccount]->setTlsVerifyClient([sender state]);
-}
-
-- (IBAction)toggleVerifyCertServer:(id)sender {
-    [self currentAccount]->setTlsVerifyServer([sender state]);
-}
-
-- (IBAction)toggleRequireCert:(id)sender {
-    [self currentAccount]->setTlsRequireClientCertificate([sender state]);
-}
-
-- (IBAction)toggleCipher:(id)sender {
-    NSInteger row = [sender clickedRow];
-    NSTableColumn *col = [sender tableColumnWithIdentifier:COLUMNID_STATE];
-    NSButtonCell *cell = [col dataCellForRow:row];
-    [self currentAccount]->cipherModel()->setData([self currentAccount]->cipherModel()->index(row, 0, QModelIndex()),
-                                           cell.state == NSOnState ? Qt::Unchecked : Qt::Checked, Qt::CheckStateRole);
-}
-
-- (void) updateControlsWithTag:(NSInteger) tag
-{
-    switch (tag) {
-        case TagViews::PVK_PASSWORD: {
-                [pvkPasswordField setStringValue:[self currentAccount]->tlsPassword().toNSString()];
-                BOOL passMatch = [self currentAccount]->tlsCertificate() &&
-            [self currentAccount]->tlsCertificate()->privateKeyMatch() == Certificate::CheckValues::PASSED;
-                [pvkPasswordValidation setImage:[NSImage imageNamed:passMatch?@"ic_action_accept":@"ic_action_cancel"]];
-            }
-            break;
-        case TagViews::OUTGOING_TLS_SRV_NAME:
-            [outgoingTlsServerName setStringValue:[self currentAccount]->tlsServerName().toNSString()];
-            break;
-        case TagViews::TLS_NEGOTIATION:
-            [tlsNegotiationTimeout setIntegerValue:[self currentAccount]->tlsNegotiationTimeoutSec()];
-            [tlsNegotiationTimeoutStepper setIntegerValue:[self currentAccount]->tlsNegotiationTimeoutSec()];
-            break;
-        default:
-            break;
-    }
-}
-
-#pragma mark - NSTextFieldDelegate methods
-
--(void)controlTextDidChange:(NSNotification *)notif
-{
-    NSTextField *textField = [notif object];
-    NSRange test = [[textField currentEditor] selectedRange];
-
-    [self valueDidChange:textField];
-    //FIXME: saving account lose focus because in NSTreeController we remove and reinsert row so View selction change
-    [textField.window makeFirstResponder:textField];
-    [[textField currentEditor] setSelectedRange:test];
-}
-
-- (IBAction) valueDidChange: (id) sender
-{
-    switch ([sender tag]) {
-        case TagViews::PVK_PASSWORD:
-            [self currentAccount]->setTlsPassword([[sender stringValue] UTF8String]);
-            break;
-        case TagViews::OUTGOING_TLS_SRV_NAME:
-            [self currentAccount]->setTlsServerName([[sender stringValue] UTF8String]);
-            break;
-        case TagViews::TLS_NEGOTIATION:
-            [self currentAccount]->setTlsNegotiationTimeoutSec([sender integerValue]);
-            break;
-        default:
-            break;
-    }
-    [self updateControlsWithTag:[sender tag]];
-}
-
-#pragma mark - NSPathControl delegate methods
-
-- (IBAction)caListPathControlSingleClick:(id)sender
-{
-    NSURL* fileURL;
-    if ([sender isKindOfClass:[NSMenuItem class]]) {
-        fileURL = nil;
-    } else {
-        fileURL = [[sender clickedPathComponentCell] URL];
-    }
-    [self->caListPathControl setURL:fileURL];
-    [self currentAccount]->setTlsCaListCertificate([[fileURL path] UTF8String]);
-
-    if ([self currentAccount]->tlsCaListCertificate()->isValid() == Certificate::CheckValues::PASSED) {
-        [showCAButton setHidden:NO];
-    } else
-        [showCAButton setHidden:YES];
-}
-
-- (IBAction)certificatePathControlSingleClick:(id)sender
-{
-    NSURL* fileURL;
-    if ([sender isKindOfClass:[NSMenuItem class]]) {
-        fileURL = nil;
-    } else {
-        fileURL = [[sender clickedPathComponentCell] URL];
-    }
-    [self->certificatePathControl setURL:fileURL];
-    [self currentAccount]->setTlsCertificate([[fileURL path] UTF8String]);
-
-    auto cert = [self currentAccount]->tlsCertificate();
-
-    if (cert) {
-        [showUserCertButton setHidden:!(cert->isValid() == Certificate::CheckValues::PASSED)];
-        [pvkContainer setHidden:!cert->requirePrivateKey()];
-    } else {
-        [showUserCertButton setHidden:YES];
-        [pvkContainer setHidden:YES];
-    }
-
-}
-
-- (IBAction)pvkFilePathControlSingleClick:(id)sender
-{
-    NSURL* fileURL;
-    if ([sender isKindOfClass:[NSMenuItem class]]) {
-        fileURL = nil;
-    } else {
-        fileURL = [[sender clickedPathComponentCell] URL];
-    }
-    [self currentAccount]->setTlsPrivateKey([[fileURL path] UTF8String]);
-    if([self currentAccount]->tlsCertificate()->requirePrivateKeyPassword()) {
-        [pvkPasswordField setHidden:NO];
-    } else {
-        [pvkPasswordField setHidden:YES];
-    }
-}
-
-- (IBAction)showCA:(id)sender
-{
-    certificateWC = [[CertificateWC alloc] initWithWindowNibName:@"CertificateWindow"];
-    [certificateWC setCertificate:[self currentAccount]->tlsCaListCertificate()];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:certificateWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: certificateWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-}
-
-- (IBAction)showEndpointCertificate:(id)sender
-{
-    certificateWC = [[CertificateWC alloc] initWithWindowNibName:@"CertificateWindow"];
-    [certificateWC setCertificate:[self currentAccount]->tlsCertificate()];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-     [self.view.window beginSheet:certificateWC.window completionHandler:nil];
-#else
-     [NSApp beginSheet: certificateWC.window
-        modalForWindow: self.view.window
-         modalDelegate: self
-        didEndSelector: nil
-           contextInfo: nil];
-#endif
-}
-
-#pragma mark - NSPathControlDelegate methods
-
-- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel
-{
-    NSLog(@"willDisplayOpenPanel");
-    [openPanel setAllowsMultipleSelection:NO];
-    [openPanel setCanChooseDirectories:NO];
-    [openPanel setCanChooseFiles:YES];
-    [openPanel setResolvesAliases:YES];
-
-    if(pathControl == caListPathControl) {
-        [openPanel setTitle:NSLocalizedString(@"Choose a CA list", @"Open panel title")];
-    } else if (pathControl == certificatePathControl) {
-        [openPanel setTitle:NSLocalizedString(@"Choose a certificate", @"Open panel title")];
-    } else {
-        [openPanel setTitle:NSLocalizedString(@"Choose a private key file", @"Open panel title")];
-    }
-
-    [openPanel setPrompt:NSLocalizedString(@"Choose CA", @"Open panel prompt for 'Choose a file'")];
-    [openPanel setDelegate:self];
-}
-
-- (void)pathControl:(NSPathControl *)pathControl willPopUpMenu:(NSMenu *)menu
-{
-    NSMenuItem *item;
-    if(pathControl == caListPathControl) {
-        item = [menu addItemWithTitle:NSLocalizedString(@"Remove value", @"Contextual menu entry")
-                               action:@selector(caListPathControlSingleClick:) keyEquivalent:@""];
-    } else if (pathControl == certificatePathControl) {
-        item = [menu addItemWithTitle:NSLocalizedString(@"Remove value", @"Contextual menu entry")
-                               action:@selector(certificatePathControlSingleClick:) keyEquivalent:@""];
-    } else {
-        item = [menu addItemWithTitle:NSLocalizedString(@"Remove value", @"Contextual menu entry")
-                               action:@selector(pvkFilePathControlSingleClick:) keyEquivalent:@""];
-    }
-    [item setTarget:self]; // or whatever target you want
-}
-
-#pragma mark - NSOpenSavePanelDelegate delegate methods
-
-- (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError
-{
-    return YES;
-}
-
-#pragma mark - NSMenuDelegate methods
-
-- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
-{
-    auto qIdx = [self currentAccount]->tlsMethodModel()->index(index);
-    [item setTitle:qIdx.data(Qt::DisplayRole).toString().toNSString()];
-    return YES;
-}
-
-- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
-{
-    return [self currentAccount]->tlsMethodModel()->rowCount();
-}
-
-#pragma mark - NSOutlineViewDelegate methods
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
-{
-    return YES;
-}
-
-- (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    NSCell *returnCell = [tableColumn dataCell];
-    return returnCell;
-}
-
-- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
-{
-    if ([[fieldEditor string] length] == 0) {
-        // don't allow empty node names
-        return NO;
-    } else {
-        return YES;
-    }
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    return NO;
-}
-
-- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
-    if(!qIdx.isValid())
-        return;
-
-    if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME]) {
-        cell.title = qIdx.data(Qt::DisplayRole).toString().toNSString();
-    }
-}
-
-@end
diff --git a/src/AccGeneralVC.h b/src/AccSipGeneralVC.h
similarity index 72%
copy from src/AccGeneralVC.h
copy to src/AccSipGeneralVC.h
index 2a7ec82..c3a8004 100644
--- a/src/AccGeneralVC.h
+++ b/src/AccSipGeneralVC.h
@@ -1,6 +1,7 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -20,9 +21,10 @@
 #import <Cocoa/Cocoa.h>
 
 #import <account.h>
+#import "LrcModelsProtocol.h"
+#import "AccountSettingsVC.h"
 
-@interface AccGeneralVC : NSViewController <NSTextFieldDelegate> {
-
-}
+@interface AccSipGeneralVC : NSViewController <NSTextFieldDelegate, LrcModelsProtocol, AccountGeneralProtocol>
+@property (assign)BOOL accountEnabled;
 
 @end
diff --git a/src/AccSipGeneralVC.mm b/src/AccSipGeneralVC.mm
new file mode 100644
index 0000000..8746f04
--- /dev/null
+++ b/src/AccSipGeneralVC.mm
@@ -0,0 +1,255 @@
+/*
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
+ *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+
+//cocoa
+#import <Quartz/Quartz.h>
+
+//Qt
+#import <QSize>
+#import <QtMacExtras/qmacfunctions.h>
+#import <QPixmap>
+
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <api/newdevicemodel.h>
+#import <interfaces/pixmapmanipulatori.h>
+#import <globalinstances.h>
+
+#import "AccSipGeneralVC.h"
+#import "views/NSColor+RingTheme.h"
+#import "views/NSImage+Extensions.h"
+
+@interface AccSipGeneralVC ()
+
+@property (unsafe_unretained) IBOutlet NSButton* photoView;
+@property (unsafe_unretained) IBOutlet NSImageView* addProfilePhotoImage;
+@property (unsafe_unretained) IBOutlet NSTextField* displayNameField;
+@property (unsafe_unretained) IBOutlet NSTextField* userNameField;
+@property (unsafe_unretained) IBOutlet NSSecureTextField* passwordField;
+@property (unsafe_unretained) IBOutlet NSTextField* proxyField;
+@property (unsafe_unretained) IBOutlet NSTextField* voicemailField;
+@property (unsafe_unretained) IBOutlet NSTextField* serverField;
+@property (unsafe_unretained) IBOutlet NSButton* removeAccountButton;
+@property (unsafe_unretained) IBOutlet NSButton* editAccountButton;
+@property std::string selectedAccountID;
+
+@end
+
+@implementation AccSipGeneralVC
+
+//Tags for views
+typedef NS_ENUM(NSInteger, TagViews) {
+    DISPLAYNAME = 100
+};
+
+@synthesize accountModel;
+@synthesize delegate;
+@synthesize photoView,addProfilePhotoImage,displayNameField, userNameField, passwordField,proxyField,voicemailField, serverField, removeAccountButton, editAccountButton;
+
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
+{
+    if (self =  [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
+}
+
+-(void)viewDidLoad {
+    [super viewDidLoad];
+    [photoView setBordered:YES];
+    [addProfilePhotoImage setWantsLayer: YES];
+    [self setEditingMode:NO];
+    [self updateView];
+}
+
+- (void)pictureTakerDidEnd:(IKPictureTaker *) picker
+                returnCode:(NSInteger) code
+               contextInfo:(void*) contextInfo
+{
+    if (auto outputImage = [picker outputImage]) {
+        [photoView setBordered:NO];
+        auto image = [picker inputImage];
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
+        [photoView setImage: [outputImage roundCorners: outputImage.size.height * 0.5]];
+        [addProfilePhotoImage setHidden:YES];
+        auto imageToBytes = QByteArray::fromNSData([outputImage TIFFRepresentation]).toBase64();
+        std::string imageToString = std::string(imageToBytes.constData(), imageToBytes.length());
+        self.accountModel->setAvatar(self.selectedAccountID, imageToString);
+    } else if(!photoView.image) {
+        [photoView setBordered:YES];
+        [addProfilePhotoImage setHidden:NO];
+    }
+}
+
+#pragma mark - NSTextFieldDelegate methods
+
+- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor
+{
+    return YES;
+}
+
+- (IBAction)triggerAdwancedSettings: (NSButton *)sender {
+     [self.delegate triggerAdvancedOptions];
+}
+
+- (void) setSelectedAccount:(std::string) account {
+    self.selectedAccountID = account;
+    [self updateView];
+}
+
+-(void)updateView {
+    const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
+    QByteArray ba = QByteArray::fromStdString(account.profileInfo.avatar);
+
+    QVariant photo = GlobalInstances::pixmapManipulator().personPhoto(ba, nil);
+    if(QtMac::toNSImage(qvariant_cast<QPixmap>(photo))) {
+        [photoView setBordered:NO];
+        NSImage *image = QtMac::toNSImage(qvariant_cast<QPixmap>(photo));
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        image = [image cropImageToSize:CGSizeMake(newSize, newSize)];
+        [photoView setImage: [image roundCorners: image.size.height * 0.5]];
+        [addProfilePhotoImage setHidden:YES];
+    } else {
+        [photoView setImage:nil];
+        [photoView setBordered:YES];
+        [addProfilePhotoImage setHidden:NO];
+    }
+    NSString* displayName = @(account.profileInfo.alias.c_str());
+    [displayNameField setStringValue:displayName];
+
+    NSMutableAttributedString *colorTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[removeAccountButton attributedTitle]];
+    NSRange titleRange = NSMakeRange(0, [colorTitle length]);
+    [colorTitle addAttribute:NSForegroundColorAttributeName value:[NSColor errorColor] range:titleRange];
+    [removeAccountButton setAttributedTitle:colorTitle];
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    [passwordField setStringValue: @(accountProperties.password.c_str())];
+    [proxyField setStringValue: @(accountProperties.routeset.c_str())];
+    [userNameField setStringValue: @(accountProperties.username.c_str())];
+    [serverField setStringValue: @(accountProperties.hostname.c_str())];
+    [voicemailField setStringValue: @(accountProperties.mailbox.c_str())];
+    self.accountEnabled = account.enabled;
+}
+
+#pragma mark - Actions
+
+- (IBAction)editPhoto:(id)sender
+{
+    auto pictureTaker = [IKPictureTaker pictureTaker];
+
+    [pictureTaker beginPictureTakerSheetForWindow:[self.view window]
+                                     withDelegate:self
+                                   didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
+                                      contextInfo:nil];
+
+}
+
+- (IBAction)enableAccount: (NSButton *)sender {
+    const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
+    self.accountModel->enableAccount(self.selectedAccountID, !account.enabled);
+    self.accountEnabled = account.enabled;
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+}
+
+- (IBAction)removeAccount:(id)sender
+{
+    NSAlert *alert = [[NSAlert alloc] init];
+    [alert addButtonWithTitle:@"OK"];
+    [alert addButtonWithTitle:@"Cancel"];
+    [alert setMessageText: NSLocalizedString(@"Remove account",
+                                             @"Remove account alert title")];
+    [alert setInformativeText:NSLocalizedString(@"By clicking \"OK\" you will remove this account on this device! This action can not be undone. Also, your registered name can be lost.",
+                                                @"Remove account alert message")];
+
+    if ([alert runModal] == NSAlertFirstButtonReturn) {
+        self.accountModel->removeAccount(self.selectedAccountID);
+    }
+}
+
+- (IBAction)changeEditingMode:(id)sender
+{
+    if([userNameField isEditable]) {
+        [self setEditingMode:NO];
+        return;
+    }
+    [self setEditingMode:YES];
+}
+
+-(void) setEditingMode:(BOOL) shouldEdit {
+    [userNameField setEditable:shouldEdit];
+    [passwordField setEditable:shouldEdit];
+    [proxyField setEditable:shouldEdit];
+    [voicemailField setEditable:shouldEdit];
+    [serverField setEditable:shouldEdit];
+    [userNameField setDrawsBackground:!shouldEdit];
+    [passwordField setDrawsBackground:!shouldEdit];
+    [proxyField setDrawsBackground:!shouldEdit];
+    [voicemailField setDrawsBackground:!shouldEdit];
+    [serverField setDrawsBackground:!shouldEdit];
+    [userNameField setBezeled:shouldEdit];
+    [passwordField setBezeled:shouldEdit];
+    [proxyField setBezeled:shouldEdit];
+    [voicemailField setBezeled:shouldEdit];
+    [serverField setBezeled:shouldEdit];
+    if(shouldEdit) {
+        [serverField setBezelStyle:NSTextFieldSquareBezel];
+        [userNameField setBezelStyle:NSTextFieldSquareBezel];
+        [passwordField setBezelStyle:NSTextFieldSquareBezel];
+        [proxyField setBezelStyle:NSTextFieldSquareBezel];
+        [voicemailField setBezelStyle:NSTextFieldSquareBezel];
+        [userNameField becomeFirstResponder];
+        [editAccountButton setTitle:@"Done"];
+        return;
+    }
+    [self saveAccount];
+    [editAccountButton setTitle:@"Edit Account"];
+    [self.view resignFirstResponder];
+}
+
+-(void) saveAccount {
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    accountProperties.hostname = [serverField.stringValue UTF8String];
+    accountProperties.password = [passwordField.stringValue UTF8String];
+    accountProperties.username = [userNameField.stringValue UTF8String];
+    accountProperties.routeset = [proxyField.stringValue UTF8String];
+    accountProperties.mailbox = [voicemailField.stringValue UTF8String];
+    self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+}
+
+#pragma mark - NSTextFieldDelegate delegate methods
+
+- (void)controlTextDidChange:(NSNotification *)notif
+{
+    NSTextField* textField = [notif object];
+    if (textField.tag != DISPLAYNAME) {
+        return;
+    }
+    NSString* displayName = textField.stringValue;
+
+    [NSObject cancelPreviousPerformRequestsWithTarget:self];
+    self.accountModel->setAlias(self.selectedAccountID, [displayName UTF8String]);
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+}
+
+@end
diff --git a/src/AccountSettingsVC.h b/src/AccountSettingsVC.h
new file mode 100644
index 0000000..29e78c7
--- /dev/null
+++ b/src/AccountSettingsVC.h
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 2018 Savoir-faire Linux Inc.
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import "LrcModelsProtocol.h"
+#include <string>
+
+@protocol AccountGeneralDelegate <NSObject>
+-(void) triggerAdvancedOptions;
+-(void) updateFrame;
+@end
+
+@protocol AccountGeneralProtocol
+@property (retain, nonatomic) id <AccountGeneralDelegate> delegate;
+- (IBAction)triggerAdwancedSettings: (NSButton *)sender;
+- (void) setSelectedAccount:(std::string) account;
+@end
+
+@interface AccountSettingsVC : NSViewController <LrcModelsProtocol, AccountGeneralDelegate>
+- (void) initFrame;
+- (void) setSelectedAccount:(std::string) account;
+- (void) show;
+-(void) hide;
+
+@end
diff --git a/src/AccountSettingsVC.mm b/src/AccountSettingsVC.mm
new file mode 100644
index 0000000..30f36dd
--- /dev/null
+++ b/src/AccountSettingsVC.mm
@@ -0,0 +1,161 @@
+/*
+ *  Copyright (C) 2018 Savoir-faire Linux Inc.
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+
+//LRC
+#import <api/lrc.h>
+#import <api/account.h>
+#import <api/newaccountmodel.h>
+
+#import "views/NSColor+RingTheme.h"
+#import "AccountSettingsVC.h"
+#import "AccRingGeneralVC.h"
+#import "AccSipGeneralVC.h"
+#import "AccAdvancedRingVC.h"
+#import "AccAdvancedSipVC.h"
+
+@interface AccountSettingsVC ()
+
+@property (unsafe_unretained) IBOutlet NSScrollView *containerView;
+@property (unsafe_unretained) IBOutlet NSView *settingsView;
+
+@end
+
+@implementation AccountSettingsVC
+
+std::string selectedAccountID;
+NSViewController <AccountGeneralProtocol>* accountGeneralVC;
+NSViewController <AccountAdvancedProtocol>* accountAdvancedVC;
+AccRingGeneralVC* ringGeneralVC;
+AccSipGeneralVC* sipGeneralVC;
+AccAdvancedRingVC* ringAdvancedVC;
+AccAdvancedSipVC* sipAdvancedVC;
+
+CGFloat const VIEW_INSET = 20;
+
+@synthesize accountModel;
+
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
+{
+    if (self =  [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+   ringGeneralVC =  [[AccRingGeneralVC alloc] initWithNibName:@"AccRingGeneral" bundle:nil accountmodel: accountModel];
+   sipGeneralVC =  [[AccSipGeneralVC alloc] initWithNibName:@"AccSipGeneral" bundle:nil accountmodel: accountModel];
+   ringAdvancedVC = [[AccAdvancedRingVC alloc] initWithNibName:@"AccAdvancedRing" bundle:nil accountmodel: accountModel];
+   sipAdvancedVC = [[AccAdvancedSipVC alloc] initWithNibName:@"AccAdvancedSip" bundle:nil accountmodel: accountModel];
+   return self;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [self.view setWantsLayer:YES];
+    [self.view setLayer:[CALayer layer]];
+    [self.view.layer setBackgroundColor:[NSColor ringGreyHighlight].CGColor];
+    [self.view.layer setCornerRadius:5.0f];
+}
+
+- (void) initFrame
+{
+    [self.view setFrame:self.view.superview.bounds];
+    [self.view setHidden:YES];
+}
+
+- (void) setSelectedAccount:(std::string) account {
+    selectedAccountID = account;
+    const auto& accountInfo = accountModel->getAccountInfo(selectedAccountID);
+    if (accountInfo.profileInfo.type == lrc::api::profile::Type::RING) {
+        accountGeneralVC = ringGeneralVC;
+        accountGeneralVC.delegate = self;
+        accountAdvancedVC = ringAdvancedVC;
+    } else if (accountInfo.profileInfo.type == lrc::api::profile::Type::SIP){
+        accountGeneralVC = sipGeneralVC;
+        accountGeneralVC.delegate = self;
+        accountAdvancedVC = sipAdvancedVC;
+    } else {
+        [self hide];
+        return;
+    }
+    [accountGeneralVC setSelectedAccount: selectedAccountID];
+    [accountAdvancedVC setSelectedAccount: selectedAccountID];
+    [self displayGeneralSettings];
+}
+
+- (void) show {
+    [self.view setHidden:NO];
+    [self displayGeneralSettings];
+}
+
+-(void)displayGeneralSettings {
+    self.containerView.documentView = accountGeneralVC.view;
+    int bottomInset = self.containerView.frame.size.height - accountGeneralVC.view.frame.size.height - VIEW_INSET;
+    self.containerView.contentInsets = NSEdgeInsetsMake(VIEW_INSET, 0, bottomInset, 0);
+}
+
+-(void)displayAllSettings {
+    CGRect settingsFrame = accountGeneralVC.view.frame;
+    settingsFrame.size.height = settingsFrame.size.height + accountAdvancedVC.view.frame.size.height;
+    NSView* container = [[NSView alloc] initWithFrame:settingsFrame];
+    [container addSubview:accountAdvancedVC.view];
+    CGRect generalSettingsFrame = accountGeneralVC.view.frame;
+    generalSettingsFrame.origin.y = accountAdvancedVC.view.frame.size.height;
+    accountGeneralVC.view.frame = generalSettingsFrame;
+    [container addSubview:accountGeneralVC.view];
+    self.containerView.documentView = container;
+    int bottomInset = self.containerView.frame.size.height - accountGeneralVC.view.frame.size.height - accountAdvancedVC.view.frame.size.height - VIEW_INSET;
+    self.containerView.contentInsets = NSEdgeInsetsMake(VIEW_INSET, 0, (bottomInset > 0) ? bottomInset : 0, 0);
+   [self scrollToTopScrollView: self.containerView];
+}
+
+-(void) scrollToTopScrollView: (NSScrollView *) scrollView {
+    NSPoint newScrollOrigin;
+    if ([[scrollView documentView] isFlipped]) {
+        newScrollOrigin=NSMakePoint(0.0,0.0);
+    } else {
+        newScrollOrigin=NSMakePoint(0.0,NSMaxY([[scrollView documentView] frame])
+                                    -NSHeight([[scrollView contentView] bounds]));
+    }
+
+    [[scrollView documentView] scrollPoint:newScrollOrigin];
+}
+
+
+#pragma mark - AccountGeneralDelegate methods
+
+-(void) updateFrame {
+    if (accountAdvancedVC.view.superview == self.containerView.documentView) {
+        [self displayAllSettings];
+        return;
+    }
+    [self displayGeneralSettings];
+}
+
+-(void) triggerAdvancedOptions {
+    if(self.containerView.documentView.frame.size.height == (accountGeneralVC.view.frame.size.height + accountAdvancedVC.view.frame.size.height)) {
+        [self displayGeneralSettings];
+        return;
+    }
+    [self displayAllSettings];
+}
+
+- (void) hide {
+    [self.view setHidden:YES];
+}
+
+@end
diff --git a/src/AccountsVC.mm b/src/AccountsVC.mm
deleted file mode 100644
index fa856cf..0000000
--- a/src/AccountsVC.mm
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- */
-
-#import "AccountsVC.h"
-
-// Qt
-#import <QItemSelectionModel>
-#import <QSortFilterProxyModel>
-#import <QtCore/qdir.h>
-#import <QtCore/qstandardpaths.h>
-
-// LRC
-#import <accountmodel.h>
-#import <protocolmodel.h>
-#import <account.h>
-
-#import "QNSTreeController.h"
-#import "AccGeneralVC.h"
-#import "AccMediaVC.h"
-#import "AccAdvancedVC.h"
-#import "AccSecurityVC.h"
-#import "AccRingVC.h"
-#import "AccDevicesVC.h"
-#import "BackupAccountWC.h"
-#import "RestoreAccountWC.h"
-#import "RingWizardWC.h"
-#import "AccBannedContactsVC.h"
-
-@interface AccountsVC () <BackupAccountDelegate, RestoreAccountDelegate>
-
-@property (assign) IBOutlet NSPopUpButton *protocolList;
-
-@property (assign) IBOutlet NSTabView *configPanels;
-@property (retain) IBOutlet NSTabViewItem *generalTabItem;
-@property (retain) IBOutlet NSTabViewItem *mediaTabItem;
-@property (retain) IBOutlet NSTabViewItem *advancedTabItem;
-@property (retain) IBOutlet NSTabViewItem *securityTabItem;
-@property (retain) IBOutlet NSTabViewItem *ringTabItem;
-@property (retain) IBOutlet NSTabViewItem *ringDevicesTabItem;
-@property (retain) IBOutlet NSTabViewItem *bannedListTabItem;
-
-@property QNSTreeController *treeController;
-@property (assign) IBOutlet NSOutlineView *accountsListView;
-@property (assign) IBOutlet NSTabView *accountDetailsView;
-@property (unsafe_unretained) IBOutlet NSButton* exportAccountButton;
-
-@property AccRingVC* ringVC;
-@property AccDevicesVC* devicesVC;
-@property AccGeneralVC* generalVC;
-@property AccMediaVC* audioVC;
-@property AccAdvancedVC* advancedVC;
-@property AccBannedContactsVC* bannedContactsVC;
-@property AccSecurityVC* securityVC;
-@property AbstractLoadingWC* accountModal;
-@property RingWizardWC* wizard;
-
-@end
-
-@implementation AccountsVC
-@synthesize protocolList;
-@synthesize configPanels;
-@synthesize generalTabItem;
-@synthesize mediaTabItem;
-@synthesize advancedTabItem;
-@synthesize securityTabItem;
-@synthesize ringTabItem;
-@synthesize ringDevicesTabItem;
-@synthesize accountsListView;
-@synthesize accountDetailsView;
-@synthesize treeController;
-@synthesize accountModal;
-@synthesize wizard;
-@synthesize bannedListTabItem;
-
-NSInteger const TAG_CHECK       =   100;
-NSInteger const TAG_NAME        =   200;
-NSInteger const TAG_STATUS      =   300;
-NSInteger const TAG_TYPE        =   400;
-
-QMetaObject::Connection accountChangedConnection, selectedAccountChangedConnection, accountTypeChangedConnection;
-
-@synthesize accountModel;
-
-
-- (void)loadView {
-    [super loadView];
-    treeController = [[QNSTreeController alloc] initWithQModel:&AccountModel::instance()];
-    [treeController setAvoidsEmptySelection:NO];
-    [treeController setAlwaysUsesMultipleValuesMarker:YES];
-    [treeController setChildrenKeyPath:@"children"];
-
-    [accountsListView bind:@"content" toObject:treeController withKeyPath:@"arrangedObjects" options:nil];
-    [accountsListView bind:@"sortDescriptors" toObject:treeController withKeyPath:@"sortDescriptors" options:nil];
-    [accountsListView bind:@"selectionIndexPaths" toObject:treeController withKeyPath:@"selectionIndexPaths" options:nil];
-
-    QObject::disconnect(accountChangedConnection);
-    QObject::disconnect(selectedAccountChangedConnection);
-
-    accountChangedConnection = QObject::connect(&AccountModel::instance(),
-                                                &QAbstractItemModel::dataChanged,
-                                                [=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
-                                                    [accountsListView reloadDataForRowIndexes:
-                                                     [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(topLeft.row(), bottomRight.row() + 1)]
-                                                                                columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, accountsListView.tableColumns.count)]];
-                                                });
-
-    selectedAccountChangedConnection = QObject::connect(AccountModel::instance().selectionModel(),
-                                                        &QItemSelectionModel::currentChanged,
-                                                        [=](const QModelIndex &current, const QModelIndex &previous) {
-                                                            [accountDetailsView setHidden:!current.isValid()];
-                                                            if(!current.isValid()) {
-                                                                [accountsListView deselectAll:nil];
-                                                                return;
-                                                            }
-
-                                                            [treeController setSelectionQModelIndex:current];
-                                                        });
-    AccountModel::instance().selectionModel()->clearCurrentIndex();
-
-
-    QModelIndex qProtocolIdx = AccountModel::instance().protocolModel()->selectionModel()->currentIndex();
-    [self.protocolList addItemWithTitle:
-                           AccountModel::instance().protocolModel()->data(qProtocolIdx, Qt::DisplayRole).toString().toNSString()];
-    QObject::disconnect(accountTypeChangedConnection);
-    accountTypeChangedConnection = QObject::connect(AccountModel::instance().protocolModel()->selectionModel(),
-                                                    &QItemSelectionModel::currentChanged,
-                                                    [=](const QModelIndex &current, const QModelIndex &previous) {
-                                                        if (!current.isValid()) {
-                                                            return;
-                                                        }
-                                                        [protocolList removeAllItems];
-                                                        [protocolList addItemWithTitle:AccountModel::instance().protocolModel()->data(current, Qt::DisplayRole).toString().toNSString()];
-                                                    });
-
-    self.generalVC = [[AccGeneralVC alloc] initWithNibName:@"AccGeneral" bundle:nil];
-    [[self.generalVC view] setFrame:[self.generalTabItem.view frame]];
-    [[self.generalVC view] setBounds:[self.generalTabItem.view bounds]];
-    [self.generalTabItem setView:self.generalVC.view];
-
-    self.audioVC = [[AccMediaVC alloc] initWithNibName:@"AccMedia" bundle:nil];
-    [[self.audioVC view] setFrame:[self.mediaTabItem.view frame]];
-    [[self.audioVC view] setBounds:[self.mediaTabItem.view bounds]];
-    [self.mediaTabItem setView:self.audioVC.view];
-
-    self.advancedVC = [[AccAdvancedVC alloc] initWithNibName:@"AccAdvanced" bundle:nil];
-    [[self.advancedVC view] setFrame:[self.advancedTabItem.view frame]];
-    [[self.advancedVC view] setBounds:[self.advancedTabItem.view bounds]];
-    [self.advancedTabItem setView:self.advancedVC.view];
-
-    self.securityVC = [[AccSecurityVC alloc] initWithNibName:@"AccSecurity" bundle:nil];
-    [[self.securityVC view] setFrame:[self.securityTabItem.view frame]];
-    [[self.securityVC view] setBounds:[self.securityTabItem.view bounds]];
-    [self.securityTabItem setView:self.securityVC.view];
-
-    self.ringVC = [[AccRingVC alloc] initWithNibName:@"AccRing" bundle:nil];
-    [[self.ringVC view] setFrame:[self.ringTabItem.view frame]];
-    [[self.ringVC view] setBounds:[self.ringTabItem.view bounds]];
-    [self.ringTabItem setView:self.ringVC.view];
-
-    self.devicesVC = [[AccDevicesVC alloc] initWithNibName:@"AccDevices" bundle:nil];
-    [[self.devicesVC view] setFrame:[self.ringDevicesTabItem.view frame]];
-    [[self.devicesVC view] setBounds:[self.ringDevicesTabItem.view bounds]];
-    [self.ringDevicesTabItem setView:self.devicesVC.view];
-
-    self.bannedContactsVC = [[AccBannedContactsVC alloc] initWithNibName:@"AccBannedContacts" bundle:nil];
-    [[self.bannedContactsVC view] setFrame:[self.bannedListTabItem.view frame]];
-    [[self.bannedContactsVC view] setBounds:[self.bannedListTabItem.view bounds]];
-    [self.bannedListTabItem setView:self.bannedContactsVC.view];
-}
-
--(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
-{
-    if (self =  [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
-    {
-        self.accountModel= accountModel;
-    }
-    return self;
-}
-
-- (void) setupSIPPanels
-{
-    // Start by removing all tabs
-    for(NSTabViewItem* item in configPanels.tabViewItems) {
-        [configPanels removeTabViewItem:item];
-    }
-    [configPanels insertTabViewItem:generalTabItem atIndex:0];
-    [configPanels insertTabViewItem:mediaTabItem atIndex:1];
-    [configPanels insertTabViewItem:advancedTabItem atIndex:2];
-    [configPanels insertTabViewItem:securityTabItem atIndex:3];
-}
-
-- (void) setupRINGPanels
-{
-    // Start by removing all tabs
-    for(NSTabViewItem* item in configPanels.tabViewItems) {
-        [configPanels removeTabViewItem:item];
-    }
-
-    [configPanels insertTabViewItem:ringTabItem atIndex:0];
-    [configPanels insertTabViewItem:ringDevicesTabItem atIndex:1];
-    [configPanels insertTabViewItem:mediaTabItem atIndex:2];
-    [configPanels insertTabViewItem:advancedTabItem atIndex:3];
-    [configPanels insertTabViewItem:bannedListTabItem atIndex:4];
-}
-
-- (IBAction)toggleAccount:(NSButton*)sender {
-    NSInteger row = [accountsListView rowForView:sender];
-    auto accountToToggle = AccountModel::instance().getAccountByModelIndex(AccountModel::instance().index(row));
-    accountToToggle->setEnabled(sender.state);
-    accountToToggle << Account::EditAction::SAVE;
-}
-
-#pragma mark - NSOutlineViewDelegate methods
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
-{
-    return YES;
-}
-
-- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
-{
-    return [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
-}
-
-- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    NSTableView* result = [outlineView makeViewWithIdentifier:@"AccountView" owner:self];
-
-    QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
-    if(!qIdx.isValid())
-        return result;
-
-    NSTextField* nameLabel = [result viewWithTag:TAG_NAME];
-    NSTextField* stateLabel = [result viewWithTag:TAG_STATUS];
-    NSButton* checkButton = [result viewWithTag:TAG_CHECK];
-    NSTextField* typeLabel = [result viewWithTag:TAG_TYPE];
-
-    auto account = AccountModel::instance().getAccountByModelIndex(qIdx);
-    auto humanState = account->toHumanStateName();
-
-    [nameLabel setStringValue:account->alias().toNSString()];
-    [stateLabel setStringValue:humanState.toNSString()];
-
-    switch (account->protocol()) {
-        case Account::Protocol::SIP:
-            [typeLabel setStringValue:@"SIP"];
-            break;
-        case Account::Protocol::RING:
-            [typeLabel setStringValue:@"RING"];
-            break;
-        default:
-            break;
-    }
-
-    switch (account->registrationState()) {
-        case Account::RegistrationState::READY:
-            [stateLabel setTextColor:[NSColor colorWithCalibratedRed:116/255.0 green:179/255.0 blue:93/255.0 alpha:1.0]];
-            break;
-        case Account::RegistrationState::TRYING:
-            [stateLabel setTextColor:[NSColor redColor]];
-            break;
-        case Account::RegistrationState::UNREGISTERED:
-            [stateLabel setTextColor:[NSColor blackColor]];
-            break;
-        case Account::RegistrationState::ERROR:
-            [stateLabel setTextColor:[NSColor redColor]];
-            break;
-        default:
-            [stateLabel setTextColor:[NSColor blackColor]];
-            break;
-    }
-
-    [checkButton setState:qIdx.data(Qt::CheckStateRole).value<BOOL>()];
-
-    return result;
-}
-
-- (void)outlineViewSelectionDidChange:(NSNotification *)notification
-{
-    // ask the tree controller for the current selection
-    [self.exportAccountButton setEnabled:[[treeController selectedNodes] count] > 0];
-    if([[treeController selectedNodes] count] > 0) {
-        auto qIdx = [treeController toQIdx:[treeController selectedNodes][0]];
-        //Update details view
-        auto acc = AccountModel::instance().getAccountByModelIndex(qIdx);
-        AccountModel::instance().selectionModel()->setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
-
-        switch (acc->protocol()) {
-            case Account::Protocol::SIP:
-                [self setupSIPPanels];
-                break;
-            case Account::Protocol::RING:
-                [self setupRINGPanels];
-                break;
-            default:
-                break;
-        }
-
-        [self.accountDetailsView setHidden:NO];
-    } else {
-        AccountModel::instance().selectionModel()->clearCurrentIndex();
-    }
-}
-
-#pragma mark - Delete account
-
-- (IBAction)removeAccount:(id)sender
-{
-    AccountModel::instance().remove(AccountModel::instance().selectedAccount());
-    AccountModel::instance().save();
-}
-
-#pragma mark - Advanced menu methods
-
-- (IBAction)advancedActionsClicked:(NSButton *)sender
-{
-    NSMenu* menu = [[NSMenu alloc] init];
-
-    auto backupItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Backup account", @"Contextual menu entry")
-                               action:@selector(backupAccount:)
-                        keyEquivalent:@""];
-
-    if(treeController.selectedNodes.count == 0) {
-        // Use a fake selector, to grey out the Backup entry in the menu
-        [backupItem setAction:@selector(disable:)];
-    }
-
-    [menu insertItem:backupItem atIndex:0];
-
-    [menu insertItemWithTitle:NSLocalizedString(@"Restore account", @"Contextual menu entry")
-                       action:@selector(restoreAccount:)
-                keyEquivalent:@""
-                      atIndex:0];
-
-    [NSMenu popUpContextMenu:menu withEvent:[self forgedEventForButton:sender] forView:(NSButton *)sender];
-}
-
-- (void) backupAccount:(NSMenuItem*) sender
-{
-    auto passwordWC = [[BackupAccountWC alloc] initWithDelegate:self];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: passwordWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-    [passwordWC setAllowFileSelection:NO];
-    if(treeController.selectedNodes.count > 0) {
-        QStringList accounts;
-        for (id item : [treeController selectedNodes]) {
-            QModelIndex accIdx = [treeController toQIdx:item];
-            accounts << AccountModel::instance().getAccountByModelIndex(accIdx)->id();
-        }
-        [passwordWC setAccounts:accounts];
-    }
-    [passwordWC showWindow:self];
-    accountModal = passwordWC;
-}
-
-- (void) restoreAccount:(NSMenuItem*) sender
-{
-    auto passwordWC = [[RestoreAccountWC alloc] initWithDelegate:self];
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
-    [self.view.window beginSheet:passwordWC.window completionHandler:nil];
-#else
-    [NSApp beginSheet: passwordWC.window
-       modalForWindow: self.view.window
-        modalDelegate: self
-       didEndSelector: nil
-          contextInfo: nil];
-#endif
-    [passwordWC setAllowFileSelection:YES];
-    [passwordWC showWindow:self];
-    accountModal = passwordWC;
-}
-
-- (NSEvent*) forgedEventForButton:(NSButton*) button
-{
-    NSRect frame = [button frame];
-    NSPoint menuOrigin = [[button superview]
-                          convertPoint:NSMakePoint(frame.origin.x, frame.origin.y)
-                          toView:nil];
-    return [NSEvent mouseEventWithType:NSLeftMouseDown
-                              location:menuOrigin
-                         modifierFlags:NSLeftMouseDownMask // 0x100
-                             timestamp:0
-                          windowNumber:[[button window] windowNumber]
-                               context:[[button window] graphicsContext]
-                           eventNumber:0
-                            clickCount:1
-                              pressure:1];
-}
-
-
-#pragma mark - Account creation methods
-
-- (IBAction)addAccountClicked:(NSButton *)sender
-{
-    wizard = [[RingWizardWC alloc] initWithNibName:@"RingWizard" bundle: nil accountmodel: self.accountModel];
-    [wizard showChooseWithCancelButton: YES andAdvanced: YES];
-    [self.view.window beginSheet:wizard.window completionHandler:nil];
-    [wizard showWindow:self];
-}
-
-- (void)createSIPAccount:(NSMenuItem*) sender
-{
-    auto acc = AccountModel::instance().add([NSLocalizedString(@"New SIP account", @"User label") UTF8String]);
-    acc->setDisplayName(acc->alias());
-    acc->setProtocol(Account::Protocol::SIP);
-    acc->setDTMFType(DtmfType::OverSip);
-    AccountModel::instance().save();
-}
-
-#pragma mark - BackupAccountDelegate methods
-
--(void) didCompleteExportWithPath:(NSURL*) fileUrl
-{
-    [[NSWorkspace sharedWorkspace] selectFile:fileUrl.path inFileViewerRootedAtPath:@""];
-}
-
-#pragma mark - RestoreAccountDelegate methods
-
--(void) didCompleteImport
-{
-    // Nothing to do here
-}
-
-@end
diff --git a/src/AddSIPAccountVC.mm b/src/AddSIPAccountVC.mm
index 2e3c4f2..6403fc3 100644
--- a/src/AddSIPAccountVC.mm
+++ b/src/AddSIPAccountVC.mm
@@ -28,6 +28,7 @@
 
 //ring
 #import "AddSIPAccountVC.h"
+#import "views/NSImage+Extensions.h"
 
 @interface AddSIPAccountVC () {
     __unsafe_unretained IBOutlet NSButton* photoView;
@@ -103,7 +104,7 @@
                                           QObject::disconnect(accountCreated);
                                           [self.delegate close];
                                       });
-    accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [displayName UTF8String]);
+    accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [@"SIP" UTF8String]);
 
     timeoutTimer = [NSTimer scheduledTimerWithTimeInterval:5
                                                     target:self
@@ -134,6 +135,9 @@
 {
     if (auto outputImage = [picker outputImage]) {
         [photoView setBordered:NO];
+        auto image = [picker inputImage];
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
         [photoView setImage:outputImage];
         [addProfilePhotoImage setHidden:YES];
     } else if(!photoView.image) {
diff --git a/src/BackupAccountWC.h b/src/BackupAccountWC.h
index ee0cd42..b1e1905 100644
--- a/src/BackupAccountWC.h
+++ b/src/BackupAccountWC.h
@@ -23,6 +23,7 @@
 
 #import "LoadingWCDelegate.h"
 #import "AbstractLoadingWC.h"
+#import "LrcModelsProtocol.h"
 
 @protocol BackupAccountDelegate <LoadingWCDelegate>
 
@@ -32,41 +33,11 @@
 
 @end
 
-@interface BackupAccountWC : AbstractLoadingWC
-
-- (id)initWithDelegate:(id <LoadingWCDelegate>) del;
+@interface BackupAccountWC : AbstractLoadingWC <LrcModelsProtocol>
 
 /**
  * Allow the NSPathControl of this window to select files or not
  */
 @property (nonatomic) BOOL allowFileSelection;
 
-/**
- * password string contained in passwordField.
- * This is a KVO method to bind the text with the OK Button
- * if password.length is > 0, button is enabled, otherwise disabled
- */
-@property (retain) NSString* password;
-
-/**
- * Object uses to store account to exports
- */
-@property (assign) QStringList accounts;
-
-/**
- * passwordConfirmation string contained in passwordConfirmationField.
- */
-@property (retain) NSString* passwordConfirmation;
-
-/**
- * computed properties calculated by password string contained in
- * passwordField and passwordCOnfirmation string contained
- * inpasswordConfirmationField
- * This is a KVO method to bind the text with the OK Button
- * if password.length is > 0 AND passwordConfirmation.length > 0
- * AND password isEqualsToString passwordCOnfirmationbutton is enabled,
- * otherwise disabled
- */
-@property (readonly) BOOL validatePasswords;
-
 @end
diff --git a/src/BackupAccountWC.mm b/src/BackupAccountWC.mm
index e530d1f..803ab94 100644
--- a/src/BackupAccountWC.mm
+++ b/src/BackupAccountWC.mm
@@ -19,17 +19,17 @@
 #import "BackupAccountWC.h"
 
 //LRC
-#import <accountmodel.h>
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <account.h>
 
 //Ring
 #import "views/ITProgressIndicator.h"
 
 @interface BackupAccountWC() <NSTextFieldDelegate> {
     __unsafe_unretained IBOutlet NSPathControl* path;
-    __unsafe_unretained IBOutlet NSSecureTextField* passwordField;
-    __unsafe_unretained IBOutlet NSSecureTextField* passwordConfirmationField;
     __unsafe_unretained IBOutlet ITProgressIndicator* progressIndicator;
-
+    __unsafe_unretained IBOutlet NSButton* cancelButton;
 }
 
 @end
@@ -39,16 +39,16 @@
         unsigned int didCompleteExport:1;
     } delegateRespondsTo;
 }
-@synthesize accounts;
 
-- (id)initWithDelegate:(id <LoadingWCDelegate>) del
-{
-    return [self initWithDelegate:del actionCode:0];
-}
+@synthesize accountModel;
 
-- (id)initWithDelegate:(id <BackupAccountDelegate>) del actionCode:(NSInteger) code
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
 {
-    return [super initWithWindowNibName:@"BackupAccountWindow" delegate:del actionCode:code];
+    if (self = [self initWithWindowNibName:nibNameOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
 }
 
 - (void)windowDidLoad
@@ -65,18 +65,6 @@
     }
 }
 
-- (BOOL)validatePasswords
-{
-    BOOL result = (self.password.length != 0 && [self.password isEqualToString:self.passwordConfirmation]);
-    NSLog(@"ValidatesPasswords : %s", result ? "true" : "false");
-    return result;
-}
-
-+ (NSSet *)keyPathsForValuesAffectingValidatePasswords
-{
-    return [NSSet setWithObjects:@"password", @"passwordConfirmation", nil];
-}
-
 - (void) setAllowFileSelection:(BOOL) b
 {
     _allowFileSelection = b;
@@ -85,20 +73,22 @@
 
 - (IBAction)completeAction:(id)sender
 {
-    auto finalURL = [path.URL URLByAppendingPathComponent:@"accounts.ring"];
+    auto accounts = accountModel->getAccountList();
+    if(accounts.empty()) {
+        return;
+    }
+    auto selectedAccountID = accounts.at(0);
+    auto finalURL = [path.URL URLByAppendingPathComponent:[@"Account_" stringByAppendingString: @(selectedAccountID.c_str())]];
     [self showLoading];
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        int result = AccountModel::instance().exportAccounts(accounts, finalURL.path.UTF8String, passwordField.stringValue.UTF8String);
-        switch (result) {
-            case 0:
-                if (delegateRespondsTo.didCompleteExport){
-                    [((id<BackupAccountDelegate>)self.delegate) didCompleteExportWithPath:finalURL];
-                }
-                [self close];
-                break;
-            default:{
-                [self showError] ;
-            }break;
+        if (self.accountModel->exportToFile(selectedAccountID, finalURL.path.UTF8String)) {
+            if (delegateRespondsTo.didCompleteExport) {
+                [((id<BackupAccountDelegate>)self.delegate) didCompleteExportWithPath:finalURL];
+            }
+            [self close];
+            [self.window.sheetParent endSheet: self.window];
+        } else {
+            [self showError];
         }
     });
 }
diff --git a/src/ChooseAccountVC.h b/src/ChooseAccountVC.h
index f8a1c27..c4da605 100644
--- a/src/ChooseAccountVC.h
+++ b/src/ChooseAccountVC.h
@@ -31,14 +31,20 @@
     }
 }
 
-@class RingWindowController;
+@protocol ChooseAccountDelegate <NSObject>
+- (void) selectAccount:(const lrc::api::account::Info&)accInfo currentRemoved:(BOOL) removed;
+- (void) allAccountsDeleted;
+- (void) createNewAccount;
+@end
 
 @interface ChooseAccountVC : NSViewController
 
+@property (retain, nonatomic) id <ChooseAccountDelegate> delegate;
+
 @property (readonly) const lrc::api::account::Info& selectedAccount;
 
 -(void) enable;
 -(void) disable;
--(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil model:(const lrc::api::NewAccountModel*) accMdl delegate:(RingWindowController *)mainWindow;
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil model:(lrc::api::NewAccountModel*) accMdl delegate:(id <ChooseAccountDelegate> )mainWindow;
 
 @end
diff --git a/src/ChooseAccountVC.mm b/src/ChooseAccountVC.mm
index fd183e3..b7e27ee 100644
--- a/src/ChooseAccountVC.mm
+++ b/src/ChooseAccountVC.mm
@@ -49,21 +49,19 @@
     __unsafe_unretained IBOutlet NSImageView*   profileImage;
     __unsafe_unretained IBOutlet NSTextField*    accountStatus;
     __unsafe_unretained IBOutlet NSPopUpButton* accountSelectionButton;
-    const lrc::api::NewAccountModel* accMdl_;
+    lrc::api::NewAccountModel* accMdl_;
     AccountSelectionManager* accountSelectionManager_;
-    RingWindowController* delegate;
-
 }
 Boolean menuIsOpen;
 Boolean menuNeedsUpdate;
 NSMenu* accountsMenu;
 NSMenuItem* selectedMenuItem;
 
--(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil model:(const lrc::api::NewAccountModel*) accMdl delegate:(RingWindowController *)mainWindow
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil model:(lrc::api::NewAccountModel*) accMdl delegate:(id <ChooseAccountDelegate> )mainWindow
 {
     accMdl_ = accMdl;
     accountSelectionManager_ = [[AccountSelectionManager alloc] initWithAccountModel:accMdl_];
-    delegate = mainWindow;
+    self.delegate = mainWindow;
     return [self initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
 }
 
@@ -86,7 +84,7 @@
                          [self update];
                          @try {
                              auto& account = [self selectedAccount];
-                             [delegate selectAccount:account];
+                             [self.delegate selectAccount:account currentRemoved: NO];
                          }
                          @catch (NSException * e) {
                              NSLog(@"account selection failed");
@@ -100,10 +98,10 @@
                          }
                          @try {
                              auto& account = [self selectedAccount];
-                             [delegate selectAccount:account];
+                             [self.delegate selectAccount:account currentRemoved: YES];
                          }
                          @catch (NSException * e) {
-                             [delegate allAccountsDeleted];
+                             [self.delegate allAccountsDeleted];
                          }
                          [self update];
                      });
@@ -167,7 +165,7 @@
 
     // create "add a new account" menu item
     NSMenuItem* menuBarItem = [[NSMenuItem alloc]
-                               initWithTitle:@""
+                               initWithTitle:@"Add Account"
                                action:nil
                                keyEquivalent:@""];
     AccountMenuItemView *itemView = [[AccountMenuItemView alloc] initWithFrame:CGRectZero];
@@ -180,7 +178,8 @@
     [itemView.createNewAccount setTarget:self];
     [menuBarItem setView: itemView];
     [accountsMenu addItem: menuBarItem];
-    [[accountSelectionButton itemAtIndex:[accountsMenu numberOfItems] -1] setEnabled:NO];
+    [profileImage setHidden:accList.empty()];
+    [accountStatus setHidden:accList.empty()];
 }
 
 -(void) configureView: (AccountMenuItemView *) itemView forAccount:(const std::string&) accountId {
@@ -195,8 +194,7 @@
     } else {
         [itemView.accountAvatar setImage: [NSImage imageNamed:@"default_avatar_overlay.png"]];
     }
-    BOOL accountNotRegistered = account.status == lrc::api::account::Status::REGISTERED ? NO : YES;
-    [itemView.accountStatus setHidden:accountNotRegistered];
+    [itemView.accountStatus setHidden:!account.enabled];
     switch (account.profileInfo.type) {
         case lrc::api::profile::Type::SIP:
             [itemView.accountTypeLabel setStringValue:@"SIP"];
@@ -214,7 +212,7 @@
 
 - (void)createNewAccount:(id)sender {
     [accountSelectionButton.menu cancelTrackingWithoutAnimation];
-    [delegate createNewAccount];
+    [self.delegate createNewAccount];
 }
 
 -(void) updatePhoto
@@ -232,8 +230,7 @@
         } else {
             [profileImage setImage: [NSImage imageNamed:@"default_avatar_overlay.png"]];
         }
-        BOOL accountNotRegistered = account.status == lrc::api::account::Status::REGISTERED ? NO : YES;
-        [accountStatus setHidden:accountNotRegistered];
+        [accountStatus setHidden:!account.enabled];
     }
     @catch (NSException *ex) {
         NSLog(@"Caught exception %@: %@", [ex name], [ex reason]);
@@ -256,9 +253,6 @@
 - (NSAttributedString*) attributedItemTitleForAccount:(const lrc::api::account::Info&) account {
     NSString* alias = bestNameForAccount(account);
     NSString* userNameString = [self nameForAccount: account];
-    if(![alias isEqualToString:userNameString]) {
-        alias = [NSString stringWithFormat: @"%@\n", alias];
-    }
     NSFont *fontAlias = [NSFont userFontOfSize:14.0];
     NSFont *fontUserName = [NSFont userFontOfSize:11.0];
     NSColor *colorAlias = [NSColor labelColor];
@@ -271,6 +265,15 @@
     NSDictionary *userNameAttrs = [NSDictionary dictionaryWithObjectsAndKeys:fontUserName,NSFontAttributeName,
                                    colorAUserName,NSForegroundColorAttributeName,
                                    paragraphStyle,NSParagraphStyleAttributeName, nil];
+
+    if([alias isEqualToString:userNameString] || [userNameString length] == 0) {
+        paragraphStyle.paragraphSpacingBefore = 20;
+        aliasAttrs = [NSDictionary dictionaryWithObjectsAndKeys:fontAlias,NSFontAttributeName,
+                      colorAlias,NSForegroundColorAttributeName,
+                      paragraphStyle,NSParagraphStyleAttributeName, nil];
+        return [[NSAttributedString alloc] initWithString:alias attributes:aliasAttrs];
+    }
+    alias = [NSString stringWithFormat: @"%@\n", alias];
     NSAttributedString* attributedString = [[NSAttributedString alloc] initWithString:alias attributes:aliasAttrs];
     NSAttributedString* attributedStringSecond= [[NSAttributedString alloc] initWithString:userNameString attributes:userNameAttrs];
     NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
@@ -316,7 +319,7 @@
 
     auto& account = accMdl_->getAccountInfo(accList[row]);
     [accountSelectionManager_ setSavedAccount:account];
-    [delegate selectAccount:account];
+    [self.delegate selectAccount:account currentRemoved: NO];
     [self updatePhoto];
 }
 
diff --git a/src/ExportPasswordWC.h b/src/ExportPasswordWC.h
index 3a6560c..2ab7c73 100644
--- a/src/ExportPasswordWC.h
+++ b/src/ExportPasswordWC.h
@@ -19,20 +19,13 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <account.h>
 
 #import "LoadingWCDelegate.h"
 #import "AbstractLoadingWC.h"
+#import "LrcModelsProtocol.h"
+#include <string>
 
-@protocol ExportPasswordDelegate <LoadingWCDelegate>
-
-@optional
-- (void)didCompleteWithPin:(NSString*) path Password:(NSString*) password;
-- (void)didStartWithPassword:(NSString*) password;
-
-@end
-
-@interface ExportPasswordWC : AbstractLoadingWC
+@interface ExportPasswordWC : AbstractLoadingWC <LrcModelsProtocol>
 
 /**
  * password string contained in passwordField.
@@ -40,6 +33,6 @@
  * if password.length is > 0, button is enabled, otherwise disabled
  */
 @property (retain) NSString* password;
-@property (assign) Account* account;
+@property std::string selectedAccountID;
 
 @end
diff --git a/src/ExportPasswordWC.mm b/src/ExportPasswordWC.mm
index 054442e..b423b3f 100644
--- a/src/ExportPasswordWC.mm
+++ b/src/ExportPasswordWC.mm
@@ -19,7 +19,10 @@
 #import "ExportPasswordWC.h"
 
 //LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
 #import <account.h>
+#import <api/account.h>
 
 //Ring
 #import "views/ITProgressIndicator.h"
@@ -32,34 +35,19 @@
 @end
 
 @implementation ExportPasswordWC {
-    struct {
-        unsigned int didStart:1;
-        unsigned int didComplete:1;
-    } delegateRespondsTo;
+
 }
 
-@synthesize account;
+@synthesize accountModel;
 QMetaObject::Connection accountConnection;
 
-
-#pragma mark - Initialize
-- (id)initWithDelegate:(id <ExportPasswordDelegate>) del actionCode:(NSInteger) code
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
 {
-    return [super initWithWindowNibName:@"ExportPasswordWindow" delegate:del actionCode:code];
-}
-
-- (void)windowDidLoad
-{
-    [super windowDidLoad];
-}
-
-- (void)setDelegate:(id <ExportPasswordDelegate>)aDelegate
-{
-    if (super.delegate != aDelegate) {
-        [super setDelegate: aDelegate];
-        delegateRespondsTo.didStart = [aDelegate respondsToSelector:@selector(didStartWithPassword:)];
-        delegateRespondsTo.didComplete = [aDelegate respondsToSelector:@selector(didCompleteWithPin:Password:)];
+    if (self =  [self initWithWindowNibName: nibNameOrNil])
+    {
+        self.accountModel= accountModel;
     }
+    return self;
 }
 
 - (void)showError:(NSString*) errorMessage
@@ -80,44 +68,42 @@
 #pragma mark - Events Handlers
 - (IBAction)completeAction:(id)sender
 {
-    // Check to avoid exporting an old account (not supported by daemon)
-    if (account->needsMigration()) {
-        [self showError:NSLocalizedString(@"You have to migrate your account before exporting", @"Error shown to user")];
-    } else {
-        NSString* password = passwordField.stringValue;
-        [self showLoading];
-        QObject::disconnect(accountConnection);
-        accountConnection = QObject::connect(account,
-                                             &Account::exportOnRingEnded,
-                                             [=](Account::ExportOnRingStatus status,const QString &pin) {
-                                                 NSLog(@"Export ended!");
-                                                 switch (status) {
-                                                     case Account::ExportOnRingStatus::SUCCESS:{
-                                                         NSString *nsPin = pin.toNSString();
-                                                         NSLog(@"Export ended with Success, pin is %@",nsPin);
-                                                         [resultField setAttributedStringValue:[self formatPinMessage:nsPin]];
-                                                         [self showFinal];
-                                                     }
-                                                         break;
-                                                     case Account::ExportOnRingStatus::WRONG_PASSWORD:{
-                                                         NSLog(@"Export ended with wrong password");
-                                                         [self showError:NSLocalizedString(@"The password you entered does not unlock this account", @"Error shown to the user" )];
-                                                     }
-                                                         break;
-                                                     case Account::ExportOnRingStatus::NETWORK_ERROR:{
-                                                         NSLog(@"Export ended with NetworkError!");
-                                                         [self showError:NSLocalizedString(@"A network error occured during the export", @"Error shown to the user" )];
-                                                     }
-                                                         break;
-                                                     default:{
-                                                         NSLog(@"Export ended with Unknown status!");
-                                                         [self showError:NSLocalizedString(@"An error occured during the export", @"Error shown to the user" )];
-                                                     }
-                                                         break;
+    NSString* password = passwordField.stringValue;
+    [self showLoading];
+    QObject::disconnect(accountConnection);
+    accountConnection = QObject::connect(self.accountModel,
+                                         &lrc::api::NewAccountModel::exportOnRingEnded,
+                                         [self] (const std::string &accountID, lrc::api::account::ExportOnRingStatus status, const std::string &pin){
+                                             if(accountID.compare(self.selectedAccountID) != 0) {
+                                                 return;
+                                             }
+                                             switch (status) {
+                                                 case lrc::api::account::ExportOnRingStatus::SUCCESS: {
+                                                     NSString *nsPin = @(pin.c_str());
+                                                     NSLog(@"Export ended with Success, pin is %@",nsPin);
+                                                     [resultField setAttributedStringValue:[self formatPinMessage:nsPin]];
+                                                     [self showFinal];
                                                  }
-                                             });
-        account->exportOnRing(QString::fromNSString(password));
-    }
+                                                     break;
+                                                 case lrc::api::account::ExportOnRingStatus::WRONG_PASSWORD:{
+                                                     NSLog(@"Export ended with wrong password");
+                                                     [self showError:NSLocalizedString(@"The password you entered does not unlock this account", @"Error shown to the user" )];
+                                                 }
+                                                     break;
+                                                 case lrc::api::account::ExportOnRingStatus::NETWORK_ERROR:{
+                                                     NSLog(@"Export ended with NetworkError!");
+                                                     [self showError:NSLocalizedString(@"A network error occured during the export", @"Error shown to the user" )];
+                                                 }
+                                                     break;
+                                                 default:{
+                                                     NSLog(@"Export ended with Unknown status!");
+                                                     [self showError:NSLocalizedString(@"An error occured during the export", @"Error shown to the user" )];
+                                                 }
+                                                     break;
+                                             }
+                                              QObject::disconnect(accountConnection);
+                                         });
+    self.accountModel->exportOnRing(self.selectedAccountID, [password UTF8String]);
 }
 
 //TODO: Move String formatting to a dedicated Utility Classes
@@ -130,7 +116,7 @@
 
     NSMutableParagraphStyle* mutParaStyle=[[NSMutableParagraphStyle alloc] init];
     [mutParaStyle setAlignment:NSCenterTextAlignment];
-    
+
     [thePin addAttributes:[NSDictionary dictionaryWithObject:mutParaStyle forKey:NSParagraphStyleAttributeName] range:range];
 
     NSMutableAttributedString* infos = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"To complete the processs, you need to open Ring on the new device and choose the option \"Link this device to an account\". Your pin is valid for 10 minutes.","Title shown to user to concat with Pin")];
diff --git a/src/PasswordChangeWC.h b/src/PasswordChangeWC.h
index 2f141b0..59a85b5 100644
--- a/src/PasswordChangeWC.h
+++ b/src/PasswordChangeWC.h
@@ -18,10 +18,19 @@
  */
 
 #import <Cocoa/Cocoa.h>
-#import <account.h>
+#import "LrcModelsProtocol.h"
+#include <string>
 
-@interface PasswordChangeWC : NSWindowController <NSTextFieldDelegate>
+@protocol PasswordChangeDelegate
 
--(id)initWithAccount:(Account*)acc;
+@optional
+
+-(void) paswordCreatedWithSuccess:(BOOL) success;
+
+@end
+
+@interface PasswordChangeWC : NSWindowController <NSTextFieldDelegate, LrcModelsProtocol>
+@property std::string selectedAccountID;
+@property (retain, nonatomic) id <PasswordChangeDelegate> delegate;
 
 @end
diff --git a/src/PasswordChangeWC.mm b/src/PasswordChangeWC.mm
index 7331d74..dbed71a 100644
--- a/src/PasswordChangeWC.mm
+++ b/src/PasswordChangeWC.mm
@@ -18,11 +18,12 @@
  */
 
 #import "PasswordChangeWC.h"
-#import <accountmodel.h>
+#import <api/lrc.h>
+#import <api/account.h>
+#import <api/newaccountmodel.h>
 
 @implementation PasswordChangeWC
 {
-    Account* account;
     __unsafe_unretained IBOutlet NSSecureTextField *oldPassword;
     __unsafe_unretained IBOutlet NSSecureTextField *newPassword;
     __unsafe_unretained IBOutlet NSSecureTextField *repeatedPassword;
@@ -34,28 +35,35 @@
     IBOutlet NSPopover *wrongPasswordPopover;
 }
 
--(id)initWithAccount:(Account*)acc
+@synthesize accountModel;
+
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
 {
-    account = acc;
-    return [super initWithWindowNibName:@"PasswordChange"];
+    if (self = [self initWithWindowNibName:nibNameOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
 }
 
 -(void)windowDidLoad
 {
     [super windowDidLoad];
-    if (account != nullptr) {
-        const auto hasPassword = account->archiveHasPassword();
+    lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+    BOOL hasPassword = accountProperties.archiveHasPassword;
 
-        [oldPassword setEnabled:hasPassword];
-        [oldPassword setPlaceholderString:(hasPassword)?@"":NSLocalizedString(@"Account has no password", @"No password on this account text field placeholder")];
-    }
+    [oldPassword setEnabled:hasPassword];
+    [oldPassword setPlaceholderString:(hasPassword)?@"":NSLocalizedString(@"Account has no password", @"No password on this account text field placeholder")];
 }
 
 -(IBAction)accept:(id)sender
 {
-    if (account->changePassword(QString::fromNSString([oldPassword stringValue]), QString::fromNSString([newPassword stringValue])))
-    {
-        AccountModel::instance().save();
+    if (self.accountModel->changeAccountPassword(self.selectedAccountID, [[oldPassword stringValue] UTF8String], [[newPassword stringValue] UTF8String])) {
+        lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
+        BOOL haspassword = ![[newPassword stringValue] isEqualToString:@""];
+        accountProperties.archiveHasPassword = haspassword;
+        self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
+        [self.delegate paswordCreatedWithSuccess: haspassword];
         [self close];
     } else {
         [oldPassword setStringValue:@""];
@@ -68,6 +76,11 @@
     [self close];
 }
 
+-(void) close {
+    [NSApp endSheet:self.window];
+    [self.window orderOut:self];
+}
+
 #pragma mark - NSTextFieldDelegate methods
 
 -(void)controlTextDidChange:(NSNotification *)obj
diff --git a/src/PreferencesWC.mm b/src/PreferencesWC.mm
index 6a9b340..1f7dea6 100644
--- a/src/PreferencesWC.mm
+++ b/src/PreferencesWC.mm
@@ -28,7 +28,6 @@
 #import <api/datatransfermodel.h>
 
 //Ring
-#import "AccountsVC.h"
 #import "GeneralPrefsVC.h"
 #import "AudioPrefsVC.h"
 #import "VideoPrefsVC.h"
@@ -42,7 +41,6 @@
 @synthesize dataTransferModel, accountModel, behaviorController;
 
 // Identifiers used in PreferencesWindow.xib for tabs
-static auto const kProfilePrefsIdentifier = @"AccountsPrefsIdentifier";
 static auto const kGeneralPrefsIdentifier = @"GeneralPrefsIdentifier";
 static auto const kAudioPrefsIdentifer    = @"AudioPrefsIdentifer";
 static auto const kVideoPrefsIdentifer    = @"VideoPrefsIdentifer";
@@ -66,12 +64,6 @@
     return self;
 }
 
-- (void)windowWillClose:(NSNotification *)notification
-{
-    AccountModel::instance().save();
-    ProfileModel::instance().selectedProfile()->save();
-}
-
 - (IBAction)displayGeneral:(NSToolbarItem *)sender
 {
     [[prefsContainer subviews]
@@ -100,15 +92,6 @@
     [prefsContainer addSubview:currentVC.view];
 }
 
-- (IBAction)displayAccounts:(NSToolbarItem *)sender
-{
-    [[prefsContainer subviews]
-    makeObjectsPerformSelector:@selector(removeFromSuperview)];
-    currentVC = [[AccountsVC alloc] initWithNibName:@"Accounts" bundle:nil accountmodel:self.accountModel];
-    [self resizeWindowWithFrame:currentVC.view.frame];
-    [prefsContainer addSubview:currentVC.view];
-}
-
 - (void) resizeWindowWithFrame:(NSRect)fr
 {
     auto frame = [self.window frame];
diff --git a/src/RegisterNameWC.h b/src/RegisterNameWC.h
index ae54e29..48d2394 100644
--- a/src/RegisterNameWC.h
+++ b/src/RegisterNameWC.h
@@ -17,24 +17,24 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
  */
 
-#import <Cocoa/Cocoa.h>
 
 #import "AbstractLoadingWC.h"
 #import "LoadingWCDelegate.h"
+#import "LrcModelsProtocol.h"
+#include <string>
+
 
 @protocol RegisterNameDelegate <LoadingWCDelegate>
 
 @optional
 
-- (void) didRegisterNameWithSuccess;
+- (void) didRegisterName:(NSString *) name withSuccess:(BOOL) success;
 
 @end
 
-@interface RegisterNameWC : AbstractLoadingWC
+@interface RegisterNameWC : AbstractLoadingWC <LrcModelsProtocol>
 
-- (id)initWithDelegate:(id <LoadingWCDelegate>) del;
-
-@property (nonatomic, weak) NSWindowController <RegisterNameDelegate>* delegate;
+@property (nonatomic, weak) NSViewController <RegisterNameDelegate>* delegate;
 
 /**
  * KVO with the registeredNameField
@@ -49,7 +49,8 @@
 /**
  * KVO validators for the UI
  */
-@property (readonly)BOOL isPasswordValid;
 @property (assign)BOOL isUserNameAvailable;
 
+@property std::string selectedAccountID;
+
 @end
diff --git a/src/RegisterNameWC.mm b/src/RegisterNameWC.mm
index 1402fcc..9e85fbc 100644
--- a/src/RegisterNameWC.mm
+++ b/src/RegisterNameWC.mm
@@ -17,20 +17,15 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
  */
 
+#import <Cocoa/Cocoa.h>
+
 #import "RegisterNameWC.h"
-
-
-//Cocoa
-
-//LRC
-#import <accountmodel.h>
-#import <QItemSelectionModel>
-#import <account.h>
-
 #import "AppDelegate.h"
 
-@interface RegisterNameWC ()
-@end
+//LRC
+#import <api/lrc.h>
+#import <api/newaccountmodel.h>
+#import <account.h>
 
 @implementation RegisterNameWC
 {
@@ -50,30 +45,26 @@
 
 NSInteger const BLOCKCHAIN_NAME_TAG             = 2;
 
-- (id)initWithDelegate:(id <LoadingWCDelegate>) del
-{
-    return [self initWithDelegate:del actionCode:0];
-}
+@synthesize accountModel;
 
-- (id)initWithDelegate:(id <RegisterNameDelegate>) del actionCode:(NSInteger) code
+-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
 {
-    return [super initWithWindowNibName:@"RegisterNameWindow" delegate:del actionCode:code];
+    if (self = [self initWithWindowNibName:nibNameOrNil])
+    {
+        self.accountModel= accountModel;
+    }
+    return self;
 }
 
 - (void)windowDidLoad
 {
     [super windowDidLoad];
+    auto accounts = self.accountModel->getAccountList();
     [registeredNameField setTag:BLOCKCHAIN_NAME_TAG];
-    self.registeredName = @"";
     [ivLookupResult setHidden:YES];
     [indicatorLookupResult setHidden:YES];
-}
-
-#pragma mark - Input validation
-
-- (BOOL)isPasswordValid
-{
-    return self.password.length >= 6;
+    self.password = @"";
+    self.registeredName = @"";
 }
 
 #pragma mark - Username validation delegate methods
@@ -164,13 +155,11 @@
                                                }
                                                [self showLookUpAvailable:isAvailable andText: message];
                                                [self onUsernameAvailabilityChangedWithNewAvailability:isAvailable];
-
                                            }
                                            );
 
     //Start the lookup in a second so that the UI dosen't seem to freeze
     BOOL result = NameDirectory::instance().lookupName(nullptr, QString(), QString::fromNSString(usernameWaitingForLookupResult));
-
 }
 
 - (void)controlTextDidChange:(NSNotification *)notif
@@ -204,8 +193,7 @@
     [self showLoading];
     [self setCallback];
 
-    self.isUserNameAvailable = AccountModel::instance().selectedAccount()->registerName(QString::fromNSString(self.password),
-                                                                                        QString::fromNSString(self.registeredName));
+    self.isUserNameAvailable = self.accountModel->registerName(self.selectedAccountID, [self.password UTF8String], [self.registeredName UTF8String]);
     if (!self.isUserNameAvailable) {
         NSLog(@"Could not initialize registerName operation");
         QObject::disconnect(registrationEnded);
@@ -215,23 +203,27 @@
 - (void)setCallback
 {
     QObject::disconnect(registrationEnded);
-    registrationEnded = QObject::connect(AccountModel::instance().selectedAccount(),
-                                         &Account::nameRegistrationEnded,
-                                         [=] (NameDirectory::RegisterNameStatus status,  const QString& name)
-                                         {
-                                             QObject::disconnect(registrationEnded);
-                                             switch(status) {
-                                                 case NameDirectory::RegisterNameStatus::WRONG_PASSWORD:
-                                                 case NameDirectory::RegisterNameStatus::ALREADY_TAKEN:
-                                                 case NameDirectory::RegisterNameStatus::NETWORK_ERROR:
+    registrationEnded = QObject::connect(self.accountModel,
+                                         &lrc::api::NewAccountModel::nameRegistrationEnded,
+                                         [self] (const std::string& accountId, lrc::api::account::RegisterNameStatus status, const std::string& name) {
+                                             if(accountId.compare(self.selectedAccountID) != 0) {
+                                                 return;
+                                             }
+                                             switch(status)
+                                             {
+                                                 case lrc::api::account::RegisterNameStatus::SUCCESS: {
+                                                     [self.delegate didRegisterName:  self.registeredName withSuccess: YES];
+                                                     break;
+                                                 }
+                                                 case lrc::api::account::RegisterNameStatus::INVALID_NAME:
+                                                 case lrc::api::account::RegisterNameStatus::WRONG_PASSWORD:
+                                                 case lrc::api::account::RegisterNameStatus::NETWORK_ERROR:
+                                                 case lrc::api::account::RegisterNameStatus::ALREADY_TAKEN: {
                                                      [self showError];
                                                      break;
-                                                 case NameDirectory::RegisterNameStatus::SUCCESS:
-                                                     [self.delegate didRegisterNameWithSuccess];
-                                                     // Artificial refresh of the model to update the welcome view
-                                                     Q_EMIT AccountModel::instance().dataChanged(QModelIndex(), QModelIndex());
-                                                     break;
+                                                 }
                                              }
+                                             QObject::disconnect(registrationEnded);
                                          });
 }
 
@@ -241,9 +233,5 @@
     return [NSSet setWithObjects: NSStringFromSelector(@selector(isUserNameAvailable)), nil];
 }
 
-+ (NSSet *)keyPathsForValuesAffectingIsPasswordValid
-{
-    return [NSSet setWithObjects:@"password", nil];
-}
 
 @end
diff --git a/src/RingWindowController.h b/src/RingWindowController.h
index a54cfc7..c22a31e 100644
--- a/src/RingWindowController.h
+++ b/src/RingWindowController.h
@@ -18,6 +18,7 @@
  */
 #import <Cocoa/Cocoa.h>
 #import "LrcModelsProtocol.h"
+#import "ChooseAccountVC.h"
 
 namespace lrc {
     namespace api {
@@ -27,7 +28,7 @@
     }
 }
 
-@interface RingWindowController : NSWindowController <NSSharingServicePickerDelegate, LrcModelsProtocol> {
+@interface RingWindowController : NSWindowController <NSSharingServicePickerDelegate, ChooseAccountDelegate, LrcModelsProtocol> {
     IBOutlet NSView *currentView;
 }
 
@@ -47,14 +48,6 @@
 - (IBAction)openPreferences:(id)sender;
 
 /**
- * This method is intended to be used by the ChooseAccountVC to signal the fact that
- * the selected account has been changed by user. It will then forward this information
- * to relevant controllers and views.
- * @param accInfo reference to selected account
- */
-- (void) selectAccount:(const lrc::api::account::Info&)accInfo;
-
-/**
  * Method triggered when a panel on the right is closed by user action. It triggers any action needed
  * on itself or other view controllers to react properly to this event.
  */
@@ -74,11 +67,4 @@
  */
 -(void) listTypeChanged;
 
-/**
- * Triggered by Choosen account VC when all accounts deleted
- */
--(void)allAccountsDeleted;
-
-- (void) createNewAccount;
-
 @end
diff --git a/src/RingWindowController.mm b/src/RingWindowController.mm
index 2000f30..72b5022 100644
--- a/src/RingWindowController.mm
+++ b/src/RingWindowController.mm
@@ -53,9 +53,10 @@
 #import "views/IconButton.h"
 #import "views/NSColor+RingTheme.h"
 #import "views/BackgroundView.h"
-#import "ChooseAccountVC.h"
+#import "views/HoverButton.h"
 #import "utils.h"
 #import "RingWizardWC.h"
+#import "AccountSettingsVC.h"
 
 @interface RingWindowController () <MigrateRingAccountsDelegate, NSToolbarDelegate>
 
@@ -80,6 +81,7 @@
 
     CurrentCallVC* currentCallVC;
     ConversationVC* conversationVC;
+    AccountSettingsVC* settingsVC;
 
     // toolbar menu items
     ChooseAccountVC* chooseAccountVC;
@@ -87,6 +89,7 @@
 
 static NSString* const kPreferencesIdentifier        = @"PreferencesIdentifier";
 NSString* const kChangeAccountToolBarItemIdentifier  = @"ChangeAccountToolBarItemIdentifier";
+NSString* const kOpenAccountToolBarItemIdentifier    = @"OpenAccountToolBarItemIdentifier";
 
 @synthesize dataTransferModel, accountModel, behaviorController;
 @synthesize wizard;
@@ -113,15 +116,19 @@
     conversationVC = [[ConversationVC alloc] initWithNibName:@"Conversation" bundle:nil delegate:self];
     // toolbar items
     chooseAccountVC = [[ChooseAccountVC alloc] initWithNibName:@"ChooseAccount" bundle:nil model:self.accountModel delegate:self];
+    settingsVC = [[AccountSettingsVC alloc] initWithNibName:@"AccountSettings" bundle:nil accountmodel:self.accountModel];
     [callView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
     [[currentCallVC view] setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
     [[conversationVC view] setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+    [[settingsVC view] setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
 
     [callView addSubview:[currentCallVC view] positioned:NSWindowAbove relativeTo:nil];
     [callView addSubview:[conversationVC view] positioned:NSWindowAbove relativeTo:nil];
+    [self.window.contentView addSubview:[settingsVC view] positioned:NSWindowAbove relativeTo:nil];
 
     [currentCallVC initFrame];
     [conversationVC initFrame];
+    [settingsVC initFrame];
     @try {
         [smartViewVC setConversationModel: [chooseAccountVC selectedAccount].conversationModel.get()];
     }
@@ -138,6 +145,7 @@
     NSToolbar *toolbar = self.window.toolbar;
     toolbar.delegate = self;
     [toolbar insertItemWithItemIdentifier:kChangeAccountToolBarItemIdentifier atIndex:1];
+    [toolbar insertItemWithItemIdentifier:kOpenAccountToolBarItemIdentifier atIndex:1];
     // set download folder (default - 'Documents')
     NSString* path = [[NSUserDefaults standardUserDefaults] stringForKey:Preferences::DownloadFolder];
     if (!path || path.length == 0) {
@@ -169,6 +177,7 @@
                          [smartViewVC selectConversation: convInfo model:accInfo->conversationModel.get()];
                          [currentCallVC showWithAnimation:false];
                          [conversationVC hideWithAnimation:false];
+                         [self accountSettingsShouldOpen: NO];
                      });
 
     QObject::connect(self.behaviorController,
@@ -187,6 +196,7 @@
                          [smartViewVC selectConversation: convInfo model:accInfo->conversationModel.get()];
                          [currentCallVC showWithAnimation:false];
                          [conversationVC hideWithAnimation:false];
+                         [self accountSettingsShouldOpen: NO];
                      });
 
     QObject::connect(self.behaviorController,
@@ -198,6 +208,7 @@
                          [smartViewVC selectConversation: convInfo model:accInfo.conversationModel.get()];
                          [conversationVC showWithAnimation:false];
                          [currentCallVC hideWithAnimation:false];
+                         [self accountSettingsShouldOpen: NO];
                      });
 }
 
@@ -405,7 +416,7 @@
     [self checkAccountsToMigrate];
 }
 
--(void)selectAccount:(const lrc::api::account::Info&)accInfo
+- (void) selectAccount:(const lrc::api::account::Info&)accInfo currentRemoved:(BOOL) removed
 {
     // If the selected account has been changed, we close any open panel
     if ([smartViewVC setConversationModel:accInfo.conversationModel.get()]) {
@@ -415,6 +426,10 @@
 
     // Welcome view informations are also updated
     [self updateRingID];
+    [settingsVC setSelectedAccount:accInfo.id];
+    if (removed) {
+        [self accountSettingsShouldOpen: NO];
+    }
 }
 
 -(void)allAccountsDeleted
@@ -422,6 +437,7 @@
     [smartViewVC clearConversationModel];
     [currentCallVC hideWithAnimation:false];
     [conversationVC hideWithAnimation:false];
+    [self accountSettingsShouldOpen: NO];
     [self updateRingID];
 }
 
@@ -438,6 +454,7 @@
 -(void) listTypeChanged {
     [conversationVC hideWithAnimation:false];
     [currentCallVC hideWithAnimation:false];
+    [self accountSettingsShouldOpen: NO];
 }
 
 #pragma mark - NSToolbarDelegate
@@ -447,15 +464,79 @@
         NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:kChangeAccountToolBarItemIdentifier];
         toolbarItem.view = chooseAccountVC.view;
         return toolbarItem;
+    } else if(itemIdentifier == kOpenAccountToolBarItemIdentifier) {
+        NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:kOpenAccountToolBarItemIdentifier];
+        HoverButton *openSettingsButton = [[HoverButton alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
+        openSettingsButton.bgColor = [NSColor clearColor];
+        openSettingsButton.imageColor = [NSColor darkGrayColor];
+        openSettingsButton.hoverColor = [NSColor controlHighlightColor];
+        openSettingsButton.highlightColor = [NSColor lightGrayColor];
+        openSettingsButton.imageInsets = 6;
+        openSettingsButton.title = @"";
+        [openSettingsButton setBordered: NO];
+        [openSettingsButton setTransparent:YES];
+        openSettingsButton.image = [NSImage imageNamed: NSImageNameSmartBadgeTemplate];
+        [openSettingsButton setAction:@selector(openAccountSettings:)];
+        [openSettingsButton setTarget:self];
+        toolbarItem.view = openSettingsButton;
+        return toolbarItem;
     }
     return nil;
 }
 
+- (IBAction)openAccountSettings:(NSButton *)sender
+{
+    if(![settingsVC.view isHidden]) {
+        [self accountSettingsShouldOpen: NO];
+        return;
+    }
+    [self accountSettingsShouldOpen: YES];
+}
+
 - (void) createNewAccount {
+    [self accountSettingsShouldOpen: NO];
+    [currentCallVC hideWithAnimation:false];
+    [conversationVC hideWithAnimation:false];
     wizard = [[RingWizardWC alloc] initWithNibName:@"RingWizard" bundle: nil accountmodel: self.accountModel];
     [wizard showChooseWithCancelButton: YES andAdvanced: YES];
     [self.window beginSheet:wizard.window completionHandler:nil];
-    [wizard showWindow:self];
+}
+
+-(void) accountSettingsShouldOpen: (BOOL) open {
+    if (open) {
+        @try {
+            [settingsVC setSelectedAccount: [chooseAccountVC selectedAccount].id];
+        }
+        @catch (NSException *ex) {
+            NSLog(@"Caught exception %@: %@", [ex name], [ex reason]);
+            return;
+        }
+        [currentCallVC hideWithAnimation:false];
+        [conversationVC hideWithAnimation:false];
+        [settingsVC show];
+    } else {
+        [settingsVC hide];
+    }
+    NSToolbar *toolbar = self.window.toolbar;
+    NSArray *settings = [toolbar items];
+
+    for(NSToolbarItem *toolbarItem in settings) {
+        if (toolbarItem.itemIdentifier == kOpenAccountToolBarItemIdentifier) {
+            HoverButton *openSettingsButton = [[HoverButton alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
+            openSettingsButton.bgColor = [NSColor clearColor];
+            openSettingsButton.imageColor = [NSColor darkGrayColor];
+            openSettingsButton.hoverColor = [NSColor controlHighlightColor];
+            openSettingsButton.highlightColor = [NSColor lightGrayColor];
+            openSettingsButton.imageInsets = 6;
+            openSettingsButton.title = @"";
+            [openSettingsButton setBordered: NO];
+            [openSettingsButton setTransparent:YES];
+            openSettingsButton.image = open ? [NSImage imageNamed: NSImageNameMenuOnStateTemplate] : [NSImage imageNamed: NSImageNameSmartBadgeTemplate];
+            [openSettingsButton setAction:@selector(openAccountSettings:)];
+            [openSettingsButton setTarget:self];
+            toolbarItem.view = openSettingsButton;
+        }
+    }
 }
 
 @end
diff --git a/src/RingWizardNewAccountVC.mm b/src/RingWizardNewAccountVC.mm
index 0c61cd4..3fa090b 100644
--- a/src/RingWizardNewAccountVC.mm
+++ b/src/RingWizardNewAccountVC.mm
@@ -164,6 +164,9 @@
 {
     if (auto outputImage = [picker outputImage]) {
         [photoView setBordered:NO];
+        auto image = [picker inputImage];
+        CGFloat newSize = MIN(image.size.height, image.size.width);
+        outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
         [photoView setImage:outputImage];
         [addProfilePhotoImage setHidden:YES];
     } else if(!photoView.image) {
@@ -271,7 +274,7 @@
     [self display:loadingView];
     [progressBar startAnimation:nil];
 
-    accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, [displayNameField.stringValue UTF8String],"",[passwordField.stringValue UTF8String]);
+    accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, [displayNameField.stringValue UTF8String],"",[passwordField.stringValue UTF8String], "");
 }
 
 /**
diff --git a/src/RingWizardWC.mm b/src/RingWizardWC.mm
index e7c2109..1f1a21b 100644
--- a/src/RingWizardWC.mm
+++ b/src/RingWizardWC.mm
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
+ *  Copyright (C) 2015-2018 Savoir-faire Linux Inc.
  *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
  *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
@@ -175,6 +175,7 @@
         [self showSIPAccountVC];
     } else {
         [self.window close];
+        [NSApp endSheet:self.window];
         [[NSApplication sharedApplication] removeWindowsItem:self.window];
     }
 }
@@ -185,6 +186,7 @@
 {
     if (success) {
         [self.window close];
+        [NSApp endSheet:self.window];
         [[NSApplication sharedApplication] removeWindowsItem:self.window];
         if (!isCancelable){
             AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
@@ -201,6 +203,7 @@
 {
     if (success) {
         [self.window close];
+        [NSApp endSheet:self.window];
         [[NSApplication sharedApplication] removeWindowsItem:self.window];
         if (!isCancelable){
             AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
@@ -215,6 +218,7 @@
 
 - (void)close {
     [self.window close];
+    [NSApp endSheet:self.window];
     [[NSApplication sharedApplication] removeWindowsItem:self.window];
 }
 
diff --git a/src/utils.h b/src/utils.h
index 2ca45c9..144ca95 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -62,6 +62,22 @@
     return @(account.profileInfo.alias.c_str());
 }
 
+static inline NSString* bestIDForContact(const lrc::api::contact::Info& contact)
+{
+    if (!contact.registeredName.empty()) {
+        return [@(contact.registeredName.c_str()) removeEmptyLinesAtBorders];
+    }
+    return [@(contact.profileInfo.uri.c_str()) removeEmptyLinesAtBorders];
+}
+
+static inline NSString* bestNameForContact(const lrc::api::contact::Info& contact)
+{
+    if (contact.profileInfo.alias.empty()) {
+        return bestIDForContact(contact);
+    }
+    return @(contact.profileInfo.alias.c_str());
+}
+
 static inline NSString* bestNameForConversation(const lrc::api::conversation::Info& conv, const lrc::api::ConversationModel& model)
 {
     auto contact = model.owner.contactModel->getContact(conv.participants[0]);
diff --git a/src/AccGeneralVC.h b/src/views/CenteredClipView.h
similarity index 78%
copy from src/AccGeneralVC.h
copy to src/views/CenteredClipView.h
index 2a7ec82..caa44ea 100644
--- a/src/AccGeneralVC.h
+++ b/src/views/CenteredClipView.h
@@ -1,6 +1,6 @@
 /*
- *  Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
+ *  Copyright (C) 2018 Savoir-faire Linux Inc.
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,10 +19,6 @@
 
 #import <Cocoa/Cocoa.h>
 
-#import <account.h>
-
-@interface AccGeneralVC : NSViewController <NSTextFieldDelegate> {
-
-}
+@interface CenteredClipView : NSClipView
 
 @end
diff --git a/src/views/CenteredClipView.mm b/src/views/CenteredClipView.mm
new file mode 100644
index 0000000..cd193c9
--- /dev/null
+++ b/src/views/CenteredClipView.mm
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (C) 2018 Savoir-faire Linux Inc.
+ *  Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+ */
+
+#import "CenteredClipView.h"
+
+@implementation CenteredClipView
+
+- (NSRect)constrainBoundsRect:(NSRect)proposedClipViewBoundsRect {
+
+    NSRect rect = [super constrainBoundsRect:proposedClipViewBoundsRect];
+    NSView * view = self.documentView;
+    if (view) {
+
+        if (proposedClipViewBoundsRect.size.width > view.frame.size.width) {
+            rect.origin.x = (rect.size.width - view.frame.size.width) / -2.0 ;
+        }
+    }
+    return rect;
+}
+@end
diff --git a/src/views/HoverButton.mm b/src/views/HoverButton.mm
index 086d2ad..de45ee0 100644
--- a/src/views/HoverButton.mm
+++ b/src/views/HoverButton.mm
@@ -33,6 +33,18 @@
     self.bgColor = self.mouseOutsideColor;
 }
 
+-(instancetype)initWithFrame:(NSRect)frameRect {
+    self = [super initWithFrame: frameRect];
+    if(!self.hoverColor) {
+        self.hoverColor = [NSColor ringBlue];
+    }
+    if(!self.mouseOutsideColor) {
+        self.mouseOutsideColor = [NSColor clearColor];
+    }
+    self.bgColor = self.mouseOutsideColor;
+    return self;
+}
+
 -(void)mouseEntered:(NSEvent *)theEvent {
     if(self.isEnabled) {
         self.bgColor = self.hoverColor;
@@ -69,12 +81,5 @@
     [super drawRect:dirtyRect];
 }
 
--(void)mouseDown:(NSEvent *)theEvent
-{
-    [super mouseDown:theEvent];
-    if(self.isEnabled) {
-        self.bgColor = self.mouseOutsideColor;
-    }
-}
 
 @end
diff --git a/src/views/IconButton.mm b/src/views/IconButton.mm
index a211fc1..4002903 100644
--- a/src/views/IconButton.mm
+++ b/src/views/IconButton.mm
@@ -44,6 +44,23 @@
 
 }
 
+-(instancetype)initWithFrame:(NSRect)frameRect {
+    self = [super initWithFrame: frameRect];
+    if (!self.bgColor) {
+        self.bgColor = [NSColor ringBlue];
+    }
+
+    if (!self.cornerRadius) {
+        self.cornerRadius = @(NSWidth(self.frame) / 2);
+    }
+
+    if (self.imageInsets == 0)
+        self.imageInsets = 8.0f;
+
+    self.pressed = NO;
+    return self;
+}
+
 -(void) setPressed:(BOOL)newVal
 {
     _pressed = newVal;
diff --git a/src/views/NSColor+RingTheme.mm b/src/views/NSColor+RingTheme.mm
index a7a107d..9d1e0bc 100644
--- a/src/views/NSColor+RingTheme.mm
+++ b/src/views/NSColor+RingTheme.mm
@@ -72,6 +72,9 @@
 }
 
 - (NSColor *)lightenColorByValue:(float)value {
+    if(![self isKindOfClass:[NSCalibratedRGBColorSpace class]]) {
+        return self;
+    }
     float red = [self redComponent];
     red += value;
 
@@ -85,6 +88,9 @@
 }
 
 - (NSColor *)darkenColorByValue:(float)value {
+    if(![self isKindOfClass:[NSCalibratedRGBColorSpace class]]) {
+        return self;
+    }
     float red = [self redComponent];
     red -= value;
 
diff --git a/src/views/NSImage+Extensions.h b/src/views/NSImage+Extensions.h
index 0e1d8d8..d396bf1 100644
--- a/src/views/NSImage+Extensions.h
+++ b/src/views/NSImage+Extensions.h
@@ -33,4 +33,6 @@
 
 - (NSImage *) imageResizeInsideMax:(CGFloat) dimension;
 
+- (NSImage *) cropImageToSize:(NSSize)newSize;
+
 @end
diff --git a/src/views/NSImage+Extensions.mm b/src/views/NSImage+Extensions.mm
index 01b5a3e..b53c828 100644
--- a/src/views/NSImage+Extensions.mm
+++ b/src/views/NSImage+Extensions.mm
@@ -25,6 +25,7 @@
                  newSize:(NSSize)newSize
 {
     auto sourceImage = anImage;
+    NSSize size = anImage.size;
     // Report an error if the source isn't a valid image
     if (![sourceImage isValid]) {
         NSLog(@"Invalid Image");
@@ -74,4 +75,21 @@
     return [NSImage imageResize:self newSize:size];
 }
 
+- (NSImage *) cropImageToSize:(NSSize)newSize {
+    CGImageSourceRef source;
+    NSPoint origin = CGPointMake((self.size.width - newSize.width) * 0.5, (self.size.height - newSize.height) * 0.5);
+
+    source = CGImageSourceCreateWithData((CFDataRef)[self TIFFRepresentation], NULL);
+    CGImageRef imageRef =  CGImageSourceCreateImageAtIndex(source, 0, NULL);
+
+    CGRect sizeToBe = CGRectMake(origin.x, origin.y, newSize.width, newSize.height);
+    CGImageRef croppedImage = CGImageCreateWithImageInRect(imageRef, sizeToBe);
+    NSImage *finalImage = [[NSImage alloc] initWithCGImage:croppedImage size:NSZeroSize];
+    CFRelease(imageRef);
+    CFRelease(croppedImage);
+
+    return finalImage;
+
+}
+
 @end