Moved rewriting tasks into its own package