Nice to see an update ^^ can totally understand that feeling when you push a feature and everything breaks :p but hey that's the joy of gamedev (insert bob ross equivalent for coding here)
The funny thing is, that I usually break things when I try clean up the code. When I just mindlessly add new features without caring much about optimization, it's less likely to break... :D
yeah optimization can be a pain (well at least to me as a beginer :p) well i guess here it was even more since you said you started again from scratch O.o, but as long as things work out well that's what matters :)