Enhanced Factory Pattern