Define re-write, increasing legibility and adding optional packages parameter