made resize method use a*length rather than length++"