Almost a total re-write