changed array to dynamic