simpler code for format checking

as per dried's excellent suggesstion