split master/slave/interface and extract library