re-write code