Review and basic refactoring of target.R