Refactoring to conating template in to initiate object