added dynamic array sizing