Added variable datatype; more uniform check on status