refactoring init and factory methods and adding argument parameter