Added extract_target() and test function