Cleaned up code for a bit, Added Check for CN