Added check_format to target_open. Added a target_destroy function which frees
all memory associated with target.