use vec type instead of flat array