Some minor changes and little refactor