removed dynamic memory allocation