implemented constructor method.