constructor and heap allocation