refactor the rabbit script