Add demo interface and a little refactoring