changed arrays from static to dynamic