added dynamic allocation - work in progress commented out