Fixed ryan's awful code.