Massive rewrite to use sente