Task 4 Factory method