major improvements; memory leak (address boundary error) fixed