changed static array to function