I borrowed Alex C. code.