more efficient dynamic memory; not entirely functional