main: use dynamic allocation