Added input format checking