Working with factory and constructor patterns