Wrote everything, just need to debug on mini net.