This code was simplified