Basic rewrite - needs to investigate more! Some scenarios fall over!