Reworked retarget rules & refactored them to functions