Add factory method + little refactoring.