move checkMixedContent to very beginning

of the file + indentation improvement