start to rewrite this bit