working without prediction

solved some bugs, working fine without prediction, still have the
threads problem. Commiting before changing a lot to implement
prediction.