making a copy of this, have to tweak it to get it to compile