add some branch prediction, cleanup