Move factory declaration to the constructor