Fixed one silly bug, speedup and figuring out what the hell goes wrong